Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3230368
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:55:08+00:00 2026-05-17T16:55:08+00:00

Background This is the same background as my previous question , except the Outline

  • 0

Background

This is the same background as my previous question, except the Outline view doesn’t have a fetch predicate.

  • I’ve got an NSOutlineView that shows TrainingGroup entities.

  • The NSOutlineView is bound to an NSTreeController

  • In the NSTreeController, I’ve got “Preserve Selection” ticked and “Select inserted objects” unticked.

  • Each TrainingGroup represents a folder on the local machine.

  • Each TrainingGroup can be assigned to a project. The project should propagate to all descendants of that group.

  • The project column is bound to the project property of each training group.

  • There’s a lot of data in this view. Because each time entry has an entry, there can be a total of ~15000 descendants under one training view.

Outline View

The tree looks like this:

Name                       Project              
Users                      nil                  
  John                     nil                       
    Documents              nil                  
      Acme Project         Acme Project         
        Proposal.doc       Acme Project         
          12:32-12:33      Acme Project         
          13:11-13:33      Acme Project         
          ... thousands more here!                               
        Budget.xls         Acme Project         
      Big Co Project       Big Co Project       
        Deadlines.txt      Big Co Project       
        Spec.doc           Big Co Project       
      New Project          nil                  
        StartingUp.doc     nil                  
      Personal Stuff       Personal             
        MyTreehouse.doc    Personal             
    Movies                 nil                  
      Aliens.mov           nil                  
      StepMom.mov          nil                  

On Project Assign

  • When a project is edited, the assignment to all children happens on an NSOperation subclass on a background thread so the user is free to make other selections and move around whilst all descendants are processed.

  • When the operation has finished, I run the mergeChangesFromContextDidSaveNotification: method on the main managed object context:

    mainContext = [[NSApp delegate] managedObjectContext];
    [mainContext performSelectorOnMainThread:@selector(mergeChangesFromContextDidSaveNotification:)
    withObject:notification
    waitUntilDone:YES];

  • Functionally, this works fine – all descendants are assigned to the project when the context is merged back into main.

The Problem

  • On merge, the NSOutlineView that’s bound to the main context freezes and the merge can take several seconds to complete.

  • To reduce this freeze, I’ve batched up the groups to assign into several smaller operations.

There are three problems with this batched background operation approach:

  1. The interface becomes unresponsive for a fraction of a second. This isn’t such a big deal, but it does mean small unpredictable pauses in the interface.

  2. The outline view updates each batch that’s merged back in. When it does this, the selection can be glitchy.

  3. Some projects under assigned groups remain blank. The object has been assigned the project, but the outline view hasn’t refreshed the project properly. Presumably because the main thread is interrupted by the merges.

You can see these issues in the screencast I recorded:

http://screenr.com/Fk4

The Alternative

I could merge the changes from each operation into a managed object context running on a background thread. Them maybe I could send a message to the main thread to refresh all objects within the top level group that was changed.

That might get rid of problems 1 and 3 above, but I think 2 would still be an issue.

My Question

Is there a better way of doing this?

Before I start reworking how I do this (I’ve already changed how this works once) I want to know if there’s a better way or there are any drawbacks to this approach I don’t know about.

Thanks in advance for any suggestions on alternatives.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:55:08+00:00Added an answer on May 17, 2026 at 4:55 pm

    I’m currently living with the freeze. But I think the answer is to parallel up my NSOperations and just reduce the time taken to make the merge to the minimum possible. There are doubtless lots of improvements I can make to the data model to make the operations much easier to merge in too.

    I tried to implement a merge on background thread recently, but struggled to make it work. It’ll be something I revisit, I think.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is related to my previous question here . I want 4 divs (absolute
To follow from my previous question about virtual and multiple inheritance (in a cross
My current problem regards updating context information dynamically in FormInjector , my previous question
Some background: I setup six blogs this week, all using Wordpress 2.92, installed with
Question: Is there a way to detect what XHtml conformance setting a particular ASP.Net
So here's the scoop: I wrote a tiny C# app a while back that
What's the rationale behind the formula used in the hive_trend_mapper.py program of this Hadoop
For my Master Thesis I am writing a Latex document where I must put
I've read a lot about NSDecimal, NSNumber, NSNumberDecimal, CFNumber... and it begins to be
Which XML validation tools can you recommend for both performance and accuracy, each of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.