[Mono-osx] crashing when attempting to drag and drop from a table

Tim Nichols timnichols at me.com
Tue Feb 21 22:21:50 UTC 2012


Hello again -

Figured out what my problem is.  For you monomac/C# vets, it will probably seem obvious, but for a somewhat monomac newbie coming from iOS world, it was surprising.

When my document loaded, I created my subclass of NSViewController and attached the view to a root view in the document, just like I always do in iOS.   I figured that rootView.AddSubview(myViewController.View) would keep a reference to myViewController and all would be fine.  However, as soon as I left the method that created myViewController, myViewController got garbage collected, so there was a hanging reference to my controller.

It was solved by moving myViewController declaration out of the method and promoting it to a member of the document subclass.

- Tim

On Feb 20, 2012, at 10:36 PM, Tim Nichols wrote:

> Hi -
> 
> I have a table view in a pane of a NSSplitView, and drag N drop works great from the table to another view.
> 
> However, if I resize the window a few times and attempt to drag N drop again, mono crashes with the following stack.   Anyone seen something like this?   Any ideas what could be happening?
> 
> 2012-02-20 22:31:12.051 MyApp[27157:90b] -[NSTrackingArea tableView:writeRowsWithIndexes:toPasteboard:]: unrecognized selector sent to instance 0x4516110
> 2012-02-20 22:31:12.053 MyApp[27157:90b] -[NSTrackingArea tableView:writeRowsWithIndexes:toPasteboard:]: unrecognized selector sent to instance 0x4516110
> 2012-02-20 22:31:12.057 MyApp[27157:90b] (
> 	0   CoreFoundation                      0x98a89b67 __raiseError + 231
> 	1   libobjc.A.dylib                     0x912c8149 objc_exception_throw + 155
> 	2   CoreFoundation                      0x98a8d170 -[NSObject doesNotRecognizeSelector:] + 256
> 	3   CoreFoundation                      0x989dbda9 ___forwarding___ + 457
> 	4   CoreFoundation                      0x989dbb72 _CF_forwarding_prep_0 + 50
> 	5   AppKit                              0x02f34a10 -[NSTableView _sendDataSourceWriteDragDataWithIndexes:toPasteboard:] + 100
> 	6   AppKit                              0x02f3527d -[NSTableView _performClassicDragOfIndexes:hitRow:event:] + 196
> 	7   AppKit                              0x02a7a597 -[NSTableView _performDragFromMouseDown:] + 591
> 	8   AppKit                              0x02a78c9d -[NSTableView mouseDown:] + 757
> 	9   AppKit                              0x029dbca5 -[NSWindow sendEvent:] + 7533
> 	10  AppKit                              0x029740e7 -[NSApplication sendEvent:] + 4788
> 	11  AppKit                              0x029056d5 -[NSApplication run] + 1007
> 	12  AppKit                              0x02b99261 NSApplicationMain + 1054
> 	13  ???                                 0x04482fbe 0x0 + 71839678
> 	14  ???                                 0x04482dbc 0x0 + 71839164
> 	15  ???                                 0x0143bff8 0x0 + 21217272
> 	16  ???                                 0x0143c156 0x0 + 21217622
> 	17  MyApp                       0x0000d282 mono_jit_runtime_invoke + 722
> 	18  MyApp                       0x001a436a mono_runtime_invoke + 170
> 	19  MyApp                       0x001a6f01 mono_runtime_exec_main + 705
> 	20  MyApp                       0x001a6111 mono_runtime_run_main + 929
> 	21  MyApp                       0x00069995 mono_jit_exec + 149
> 	22  MyApp                       0x0006bf13 mono_main + 9587
> 	23  MyApp                       0x00002299 main + 441
> 	24  MyApp                       0x000020a6 start + 54
> 	25  ???                                 0x00000001 0x0 + 1
> )
> 
> and sometimes this is followed with
> 
> =================================================================
> Got a SIGSEGV while executing native code. This usually indicates
> a fatal error in the mono runtime or one of the native libraries 
> used by your application.
> =================================================================
> 
> Thanks.
> 
> - Tim
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx



More information about the Mono-osx mailing list