Reputation: 1
I'm writing an app that makes heavy use of the PDF viewer to display various documents, and every so often after browsing my document library I encounter the following exception:
OutputLayer: Ecolab.SalesPad.ContentItem FreedomAire 3 Helmet Thread finished: Stacktrace:
at MonoTouch.Foundation.NSObject/MonoTouch_Disposer.Drain (MonoTouch.Foundation.NSObject) <0x000eb> at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff> at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x0010f> at Ecolab.SalesPad.Touch.Application.Main (string[]) [0x00000] in /Users/itrgroup/Projects/SalesPad/SalesPad.Touch/Main.cs:20 at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
0 SalesPadTouch 0x00b62b18 mono_handle_native_sigsegv + 456
1 SalesPadTouch 0x00b484e4 mono_sigsegv_signal_handler + 428
2 libsystem_c.dylib 0x34db7539 _sigtramp + 48
3 UIKit 0x35107b23 -[UISearchDisplayController dealloc] + 78
4 libobjc.A.dylib 0x3564b0c5 _objc_rootRelease + 36
5 SalesPadTouch 0x00489eb8 wrapper_managed_to_native_MonoTouch_ObjCRuntime_Messaging_void_objc_msgSend_intptr_intptr + 68
6 SalesPadTouch 0x0028d094 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
7 SalesPadTouch 0x00b48108 mono_jit_runtime_invoke + 2892
8 SalesPadTouch 0x00c40414 mono_runtime_invoke + 200
9 SalesPadTouch 0x00cd3944 monotouch_trampoline + 3140
10 CoreFoundation 0x33e9222b -[NSObject performSelector:withObject:] + 42
11 Foundation 0x31a01757 __NSThreadPerformPerform + 350
12 CoreFoundation 0x33f07b03 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
13 CoreFoundation 0x33f072cf __CFRunLoopDoSources0 + 214
14 CoreFoundation 0x33f06075 __CFRunLoopRun + 652
15 CoreFoundation 0x33e894dd CFRunLoopRunSpecific + 300
16 CoreFoundation 0x33e893a5 CFRunLoopRunInMode + 104
17 GraphicsServices 0x35ac9fcd GSEventRunModal + 156
18 UIKit 0x34fce743 UIApplicationMain + 1090
19 SalesPadTouch 0x00491160 wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 240
20 SalesPadTouch 0x00073d60 Ecolab_SalesPad_Touch_Application_Main_string__ + 152
21 SalesPadTouch 0x0028d094 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
22 SalesPadTouch 0x00b48108 mono_jit_runtime_invoke + 2892
23 SalesPadTouch 0x00c40414 mono_runtime_invoke + 200
24 SalesPadTouch 0x00c4353c mono_runtime_exec_main + 836
25 SalesPadTouch 0x00c4253c mono_runtime_run_main + 968
26 SalesPadTouch 0x00b4f1b8 mono_jit_exec + 244
27 SalesPadTouch 0x00b424fc main + 4076
28 SalesPadTouch 0x00002914 start + 52
================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries
It hits this on MonoTouch.Disposer_Drain every time. Sometimes after ViewDidAppear is called, sometimes before. I can't find any advice on MonoTouch.Disposer_Drain in a Google search. Has anyone run into this before? Any advice on what the cause and/or a workaround would be?
Thanks! Scott --
Upvotes: 0
Views: 345
Reputation: 19335
There are two likely causes for this:
It can be quite hard to track down the cause, but there is a hint in the stack trace:
3 UIKit 0x35107b23 -[UISearchDisplayController dealloc] + 78
it's related to a UISearchDisplayController. My guess is that the UISearchDisplayController's native destructor is trying to call into an object it has a reference to (to call that object's destructor for instance), and that object has already been freed. So I would look if any objects assigned to fields of a UISearchDisplayController (that can be normal fields, event handlers, callbacks, etc.) happen to get freed early.
Once you know which object are freed early, you must ensure that the GC can see the object as long as the UISearchDisplayController is alive (one common way is to assign it to a class variable of the appropriate class).
Update
A very similar issue has been answered here: MonoTouch SIGSEGV crash using navigationcontroller and searchdisplaycontroller, it may be what you're running into.
Upvotes: 3