On Apr 28, 2011, at 07:46, Kirill K wrote:

> the thread that adds nodes to TreeController interrupts the sequence
> (I guess) called by mouseDown event so insertObject:
> atArrangedObjectIndexPath: is called before
> thensetSelectionIndexPaths:.

If you guess the sequence of events when it fails, you may end up chasing the 
wrong problem. :) Better to actually find out what's going wrong. However ...

I think you have two fundamental flaws in your approach:

-- How well it works is going to depend on whether the NSOutlineView uses an 
event tracking loop or not, in response to 'super mouseDown:event:'. Predicting 
its behavior seems very fragile, and you'll need a deeper understanding of run 
loop modes to analyze the behavior.

-- You *think* you've solved a thread synchronization problem by pushing the 
'insertObject:...' calls into the main thread. You haven't. You've solved 2 
sub-problems: (1) preventing KVO notifications leading to UI updates on a 
background thread, and (2) preventing data corruption resulting from using 
non-thread-safe methods in multiple threads simultaneously.

Those are the easy things. The hard thing is to *design* a thread 
synchronization strategy that actually works.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to