
IB crashes when dragging item off selectable toolbar configuration sheet
Reported by Chris Purcell | October 2nd, 2009 @ 12:29 AM
Hi,
IB keeps crashing for me, when I have a BWSelectableToolBar open
in "Allowed Toolbar Items" mode. Here is the message I receive:
http://img43.imageshack.us/img43/3446/screenshot20091001at924.png
Here is the details of the error:
Assertion Message: An uncaught exception was raised.
Exception Name: NSInvalidArgumentException
Reason: *** -[NSCFDictionary setObject:forKey:]: attempt to insert
nil value (key: 0D5950D1-D4A8-44C6-9DBC-251CFEF852E2)
User Info: (null)
Thread 0 Raised an Exception:
0 CoreFoundation 0x90bce56d raiseError + 381
1 libobjc.A.dylib 0x97722f49 objc_exception_throw + 56
2 CoreFoundation 0x90bce2b8 +[NSException raise:format:arguments:]
+ 136
3 CoreFoundation 0x90bce22a +[NSException raise:format:] + 58
4 Foundation 0x96d4f8d7 -[NSCFDictionary setObject:forKey:] +
261
5 BWToolkitFramework 0x1aa9f660 -[BWSelectableToolbar initialSetup]
+ 1672
6 Foundation 0x96d78b65 NSFireDelayedPerform + 537
7 CoreFoundation 0x90b39eee _CFRunLoopRun + 6846
8 CoreFoundation 0x90b37d34 CFRunLoopRunSpecific + 452
9 CoreFoundation 0x90b37b61 CFRunLoopRunInMode + 97
10 HIToolbox 0x94ec8fec RunCurrentEventLoopInMode + 392
11 HIToolbox 0x94ec8da3 ReceiveNextEventCommon + 354
12 HIToolbox 0x94ec8c28 BlockUntilNextEventMatchingListInMode +
81
13 AppKit 0x97f59c95 DPSNextEvent + 847
14 AppKit 0x97f5950a -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
15 Interface Builder 0x000047f8
16 AppKit 0x97f1b69b -[NSApplication run] + 821
17 AppKit 0x97f13735 NSApplicationMain + 574
18 Interface Builder 0x00002aff
19 Interface Builder 0x00002a95
Comments and changes to this ticket
-
Brandon Walkin October 3rd, 2009 @ 05:01 PM
- State changed from new to cantreproduce
- Title changed from IB Crash- BWSelectableToolBar to IB crashes when selectable toolbar's configuration sheet is visible
Please provide steps to reproduce.
-
Chris Purcell October 5th, 2009 @ 12:51 AM
I reproduced this on a newly formatted 10.6.1 machine, which most up to date Xcode(3.2)/Interface builder(3.2).
1) Create new Cocoa Application Template in IB.
2) Drag BWSelectableToolbar from the library onto a NSWindow.
3) Double click the toolbar to go into "Allowed Toolbar Items" mode and attempt to drag one of the items off the bar and it crashes.Sometimes, it will just crash (IB) when dragging the toolbar from the library to the window. (Screenshot: http://img35.imageshack.us/img35/315/screenshot20091004at936.png)
Here is my console log: http://chrispurcell.net/bw_console.log
I've been able to reproduce this on two 10.6.1 Intel machines.
Let me know if there is anything else I can do to help you debug this issue. Thanks!
-
Brandon Walkin October 5th, 2009 @ 01:59 AM
- Title changed from IB crashes when selectable toolbar's configuration sheet is visible to IB crashes when dragging item off selectable toolbar configuration sheet
-
Brandon Walkin October 5th, 2009 @ 01:59 AM
- State changed from cantreproduce to accepted
Got it. Thanks.
-
Sebastian Niesen December 14th, 2009 @ 01:17 PM
The same happens on my machines using 10.6.2 and the 3.2.1 developer tools.
-
Lukhnos D. Liu February 18th, 2010 @ 01:52 PM
- Assigned user set to Brandon Walkin
The same happened to me on 10.6.2 + Xcode 3.2.2.
I took a look at my crash logs, and almost all pointed to the same place, -[BWSelectableToolbar selectItemAtIndex:].
Some NSLogging showed that on 10.6.2 + IB 3.2.2, -selectItemAtIndex: often received -1 while there were something in the toolbarItems.
Interestingly, on 10.5.8 + IB 3.1.4, -selectedItemAtIndex: never received anything out of bound[*] while there were items. It did receive out-of-bound indexes, but that was only when the item array was empty.
So I was curious if placing a boundary check would do. So far it seems fine. The xibs that I was previously not able to open in IB now opens and works fine.
As I didn't study the source code thoroughly, I'm not sure if this truly fixes the problem, but it mitigates the crashing issue for the work I'm doing.
A simple patch is attached as follows.
[*] Interestingly, on 10.5.8 the index in question would be 0x7fffffff whereas on 10.6.2 the index was 0xffffffff. Also, clicking on Continue when IB crashes is not a good idea. Ignoring the crash seems to be able to result in structurally damaged xibs, and causing further crashes in e.g. -initialSetup or -moveObject:toParent: by missing identifiers (and in turn causing methods to set nil to dictionaries or move items to wrong parents).
-
Cedric March 4th, 2010 @ 07:31 AM
I tried to apply the patch of Liu above, but still my IB crashes (10.6.2+Xcode 3.2.1). I am not familiar enough with the code to propose something (apart from expressing my deep gratitude for this excellent framework, and in particular the selectable toolbar... when it works).
-
Tito Ciuro June 7th, 2010 @ 04:04 AM
The diff provided by Lukhnos looks good to me, but it's not the only issue. If you go to BWSelectableToolbar.m:248, you'll see the culprit:
[tempCVBI setObject:[[[self editableToolbar] _window] contentView] forKey:[helper selectedIdentifier]];
When I log this statement in Console I see the following:
6/7/10 9:39:46 AM Interface Builder[36166] initialSetup: [[[self editableToolbar] _window] contentView] = (null)
The retrieved contentView is nil, which causes the exception. I have attached a diff which includes Lukhnos'. One thing remains though, which I cannot pinpoint: having applied my diff, I rearrange the icons in the toolbar and IB crashes somewhere in IB. I have also attached the crash log.
-
Robert Payne June 28th, 2010 @ 05:05 AM
- Milestone order changed from 0 to 0
Xcode Version: 3.2.x
IB Version: 3.2.3
Process: Interface Builder [6936]
Path: /Developer/Applications/Interface Builder.app/Contents/MacOS/Interface Builder
Identifier: com.apple.InterfaceBuilder3
Version: 3.2.3 (786)
Build Info: InterfaceBuilder-7860000~6
Code Type: X86-64 (Native)
Parent Process: launchd [228]Date/Time: 2010-06-28 20:53:21.006 +1200
OS Version: Mac OS X 10.6.3 (10D567)
Report Version: 6Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008
Crashed Thread: 0 Dispatch queue: com.apple.main-threadApplication Specific Information:
Assertion Message: An uncaught exception was raised.Exception Name: NSInvalidArgumentException
Reason: *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil
User Info: (null)Thread 0 Raised an Exception:
0 CoreFoundation 0x00007fff885c8d06 _exceptionPreprocess + 150
1 libobjc.A.dylib 0x00007fff806980f3 objc_exception_throw + 45
2 CoreFoundation 0x00007fff885c8b47 +[NSException raise:format:arguments:] + 103
3 CoreFoundation 0x00007fff885c8ad4 +[NSException raise:format:] + 148
4 Foundation 0x00007fff81a8ec66 -[NSCFArray insertObject:atIndex:] + 119
5 CocoaPlugin 0x00000001129df50e IBWrapIndex + 13244
6 CocoaPlugin 0x00000001129e3120 IBCounterpartTable + 336
7 AppKit 0x00007fff86dd78ac -[NSToolbarView(ItemDragAndDropSupport) dstDraggingDepositedAtPoint:draggingInfo:] + 551
8 AppKit 0x00007fff86b6c557 NSCoreDragReceiveProc + 808
9 HIServices 0x00007fff816fa663 DoDropMessage + 99
10 HIServices 0x00007fff816faaf8 SendDropMessage + 31
11 HIServices 0x00007fff816fc455 DragInApplication + 454
12 HIServices 0x00007fff816fcebd CoreDragStartDragging + 634
13 AppKit 0x00007fff86b6b670 -[NSCoreDragManager dragUntilMouseUp:accepted:] + 763
14 AppKit 0x00007fff86b6b0b6 -[NSCoreDragManager dragImage:fromWindow:at:offset:event:pasteboard:source:slideBack:] + 1594
15 AppKit 0x00007fff86e25db6 -[NSWindow(NSDrag) dragImage:at:offset:event:pasteboard:source:slideBack:] + 146
16 AppKit 0x00007fff86dd92ac -[NSToolbarView(ItemDragAndDropSupport) _beginSrcDragItemWithEvent:] + 1781
17 AppKit 0x00007fff86a37cec -[NSToolbarView mouseDown:] + 60
18 AppKit 0x00007fff86924f1b -[NSWindow sendEvent:] + 5409
19 InterfaceBuilderKit 0x0000000100144443 -[IBEditableWindow sendEvent:] + 92
20 AppKit 0x00007fff8685a662 -[NSApplication sendEvent:] + 4719
21 Interface Builder 0x0000000100003e33
22 AppKit 0x00007fff867f10aa -[NSApplication run] + 474
23 AppKit 0x00007fff867e9d7c NSApplicationMain + 364
24 Interface Builder 0x0000000100001cd4
After debugging the cause of the crash I think I have found it.
BWSelectableToolbar directly overrides a private API that sets the default toolbar items. It seems there is an issue behind the scenes with interface builder correctly using the default toolbar items now and thus causes a crash.
The easiest fix is to remove _defaultItemsIdentifiers and the - (NSArray )toolbarDefaultItemIdentifiers:(NSToolbar)toolbar delegate method.
The toolbar will start with 0 items attached to it but you can drag items on and it select a tab via the inspector and it seems to work.
You may still need to apply the patches above in regards to indexes being out of bounds.
-
Robert Payne June 28th, 2010 @ 05:59 AM
Debugging a little bit more.
It seems the crash is only related to any BWToolbarItems. If remove the _defaultItemsIdentifiers method and run the plugin in interface builder you'll have an "empty" toolbar when you drop it onto the window. If you try to add any of the BWToolbarItems to the toolbar it will crash. If you avoid using BWToolbarItems it seems to be fine.
I'm not sure why the BWToolBarItem's crash IB 3.2.3 but it definitely is the cause of the crashing.
Hope this helps let me know if you need any help testing.
-
Nocturnalist February 10th, 2011 @ 09:07 AM
I have crash while trying to Remove Button Bar:
Assertion Message: Can't get the OID of an object not in the document!
Thread 0 Asserted:
0 InterfaceBuilderKit 0x000000010012e8d7 -[IBObjectContainer objectIDForObject:] + 307
1 InterfaceBuilderKit 0x000000010012e75e -[IBObjectContainer metadataForKey:ofObject:] + 33
2 InterfaceBuilderKit 0x000000010012e738 -[IBDocument metadataForKey:ofObject:] + 50
3 InterfaceBuilderKit 0x000000010015c4a5 -[IBViewEditor guidedOffsetForDraggingInfo:] + 912
4 InterfaceBuilderKit 0x00000001001e10c7 -[IBViewEditor prepareToAcceptDragInfo:] + 469
5 InterfaceBuilderKit 0x00000001001dc079 -[IBEditor selectDragDestination:] + 82
6 InterfaceBuilderKit 0x00000001001dc05f -[IBEditor selectDragDestination:] + 56
7 InterfaceBuilderKit 0x00000001002164e2 -[IBEditorWindowController dropTargetForDragInfo:allowedDraggingOperations:] + 435
8 InterfaceBuilderKit 0x000000010015768e -[IBWindowController draggingUpdated:] + 790
9 DevToolsKit 0x000000010005a2bb DTDeliverDragginUpdated + 69
10 DevToolsKit 0x000000010005b1e1 DTTrackDragging + 2248
11 DevToolsKit 0x000000010005a132 -[DTDragManager dragImage:at:offset:mouseDownEvent:mouseDraggedEvent:pasteboard:allowedOperations:source:slideBack:draggingSourceContext:] + 62
12 DevToolsKit 0x0000000100049d6a -[DTAssetCategoryController(DTAssetCategoryControllerDragAndDrop) dragAssetPairs:withMouseDownEvent:mouseDraggedEvent:initialDraggedImageState:allowedOperations:imageLocationInWindow:] + 580
13 DevToolsKit 0x000000010004bf16 -[DTAssetCategoryController(DTAssetCategoryControllerDragAndDrop) groupedTileViewDragSelectedItems:withMouseDownEvent:andMouseDraggedEvent:] + 521
14 DevToolsKit 0x000000010003e618 -[DTGroupedTileView mouseDragged:] + 145
15 AppKit 0x00007fff8304f06f -[NSWindow sendEvent:] + 8769
16 AppKit 0x00007fff82f83a86 -[NSApplication sendEvent:] + 4719
17 Interface Builder 0x0000000100003d7d
18 AppKit 0x00007fff82f1a4da -[NSApplication run] + 474
19 AppKit 0x00007fff82f131a8 NSApplicationMain + 364
20 Interface Builder 0x0000000100001c44
21 Interface Builder 0x0000000000000002
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
BWToolkit is an Interface Builder plugin that contains commonly used UI elements and other objects designed to simplify Mac development.