NSTableView prematurely posts selection changed notification
NSTableView prematurely posts selection changed notification
- Subject: NSTableView prematurely posts selection changed notification
- From: Graham Cox <email@hidden>
- Date: Thu, 10 Jul 2008 13:21:27 +1000
When my app starts up, it opens a floating window containing a table
view. As the table is brought to life from the Nib, it posts a
"selection changed" notification to its delegate. At that time it
hasn't had its data initialised from the data model so the selected
row is 0. This causes an undesirable change to the data model.
Here's the stack trace of the table initialisation.
#0 0x00014cbd in -[GCLayersPaletteController
tableViewSelectionDidChange:] at GCLayersPaletteController.m:93
#1 0x94a5254a in _nsnote_callback
#2 0x90e14aba in __CFXNotificationPost
#3 0x90e14d93 in _CFXNotificationPostNotification
#4 0x94a4f7b0 in -[NSNotificationCenter
postNotificationName:object:userInfo:]
#5 0x94a58ff8 in -[NSNotificationCenter postNotificationName:object:]
#6 0x9363e4f1 in -[NSTableView _enableSelectionPostingAndPost]
#7 0x9363dc17 in -[NSTableView _tileAndRedisplayAll]
#8 0x9363d8c8 in -[NSTableView setDataSource:]
#9 0x93550c0c in -[NSNibOutletConnector establishConnection]
#10 0x93530aa4 in -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:]
#11 0x93526e12 in loadNib
#12 0x93526774 in +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:]
#13 0x935263b7 in +[NSBundle(NSNibLoading)
loadNibFile:externalNameTable:withZone:]
#14 0x935666b5 in -[NSWindowController loadWindow]
#15 0x9356644e in -[NSWindowController window]
#16 0x93566376 in -[NSWindowController showWindow:]
#17 0x0023ece4 in -[DKDrawkitInspectorBase showWindow:] at
DKDrawkitInspectorBase.m:164
#18 0x0000358b in -[GCDrawKitAppDelegate showLayersPalette:] at
GCDrawKitAppDelegate.m:51
#19 0x00003c48 in -[GCDrawKitAppDelegate
applicationDidFinishLaunching:] at GCDrawKitAppDelegate.m:188
This seems to be a race condition - before the table is ready I can't
populate it and set the correct row to match my data model, but
because of this notification the data model gets prematurely changed
to an incorrect row.
I can't see why it sends this notification at this point - anyone care
to explain? Anyway, how can I stop it?
cheers, Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden