Hi,

You're crashing when debugging because then we run the GC more aggressively
to catch some problems.

In this case you're probably crashing because the GC is freeing an object
which native code still has a reference to (this happens if there is no
managed reference to the object in question). From the stack trace my guess
would be an instance of a UIGestureRecognizer (but it's just a guess, there
are plenty of cases where the type shown in the stack trace is not the
freed object, it is just the type that happens to use the freed object).

The most common error is to declare variables in a method instead of in the
class, so when the method finishes executing, the GC will free the objects
you stored method variables. If you instead use class variables, the GC
will see those objects and not free them.

This is of course just a generic advice, for more specific information we'd
need to see the code that's causing the crash.

I hope this helps,

Rolf

On Tue, Dec 27, 2011 at 11:51 AM, akobold <[email protected]> wrote:

> Hello everyone.
>
> I have a simple UIScrollView, with only one page. In this page I have four
> views, and each of this child views have one label and one UIImageView.
> The Idea is that when the user touch one of these views, the app will
> navigate to another page (pretty standard stuff) - the touch on the view is
> used with a UITapGestureRecognizer.
> However, if I am debugging this on the simulator, I get a SIGSEGV when i
> touch the view (any one of them).
> If instead, I just run the program on the simulator (the same code) without
> connecting the debugger it works.
> This is the stack trace I got:
>
> Stacktrace:
>
>  at (wrapper managed-to-native)
> MonoTouch.UIKit.UIApplication.UIApplicationMain
> (int,string[],intptr,intptr)
> <IL 0x0009f, 0xffffffff>
>  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042]
> in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
>  at app.Application.Main (string[]) [0x00000] in
> /Users/Projects/app/Main.cs:16
>  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
> (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
>
> Native stacktrace:
>
>        0   app                                 0x000e1008
> mono_handle_native_sigsegv + 408
>        1   app                                 0x00011c7f
> mono_sigsegv_signal_handler + 351
>        2   libsystem_c.dylib                   0x9351f59b _sigtramp + 43
>        3   ???                                 0xffffffff 0x0 + 4294967295
>        4   UIKit                               0x0256a143
> -[UIGestureRecognizer
> _updateGestureWithEvent:] + 379
>        5   UIKit                               0x0256b3cf
> -[UIGestureRecognizer
> _delayedUpdateGesture] + 46
>        6   UIKit                               0x0256da31
> ___UIGestureRecognizerUpdate_block_invoke_0541 + 57
>        7   UIKit                               0x0256d98c
> _UIGestureRecognizerApplyBlocksToArray + 277
>        8   UIKit                               0x025663e7
> _UIGestureRecognizerUpdate + 1026
>        9   UIKit                               0x022ce812 -[UIWindow
> _sendGesturesForEvent:] + 1121
>        10  UIKit                               0x022ceba2 -[UIWindow
> sendEvent:] +
> 93
>        11  UIKit                               0x022b5384 -[UIApplication
> sendEvent:] + 464
>        12  UIKit                               0x022a8aa9
> _UIApplicationHandleEvent + 8196
>        13  GraphicsServices                    0x048a0fa9
> PurpleEventCallback +
> 1274
>        14  CoreFoundation                      0x012ab1c5
> __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
>        15  CoreFoundation                      0x01210022
> __CFRunLoopDoSource1 +
> 146
>        16  CoreFoundation                      0x0120e90a __CFRunLoopRun +
> 2218
>        17  CoreFoundation                      0x0120ddb4
> CFRunLoopRunSpecific +
> 212
>        18  CoreFoundation                      0x0120dccb
> CFRunLoopRunInMode + 123
>        19  GraphicsServices                    0x0489f879 GSEventRunModal
> + 207
>        20  GraphicsServices                    0x0489f93e GSEventRun + 114
>        21  UIKit                               0x022a6a9b
> UIApplicationMain + 1175
>        22  ???                                 0x0e038305 0x0 + 235111173
>        23  ???                                 0x0e036b90 0x0 + 235105168
>        24  ???                                 0x0e036888 0x0 + 235104392
>        25  ???                                 0x0e0369de 0x0 + 235104734
>        26  app                                 0x000119cf
> mono_jit_runtime_invoke
> + 1407
>        27  app                                 0x0022014a
> mono_runtime_invoke +
> 170
>        28  app                                 0x00222e81
> mono_runtime_exec_main +
> 705
>        29  app                                 0x00222091
> mono_runtime_run_main +
> 929
>        30  app                                 0x000ad5bf mono_jit_exec +
> 239
>        31  app                                 0x002f41aa main + 5194
>        32  app                                 0x00003035 start + 53
>
> =================================================================
> 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.
> =================================================================
>
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/UIKit-Crash-on-Debug-mode-tp4236823p4236823.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to