Bug 2293 - UIButton subclass SIGSEGVs when ImageRectForContentRect overridden
Summary: UIButton subclass SIGSEGVs when ImageRectForContentRect overridden
Status: RESOLVED DUPLICATE of bug 265
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.0
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-12-01 05:41 UTC by Jamie Briant
Modified: 2011-12-01 06:50 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 265

Description Jamie Briant 2011-12-01 05:41:06 UTC
public class MyButton : UIButton
    {
        public MyButton()
        {
        }

        public MyButton(RectangleF frame) : base(frame)
        {
        }


        public override RectangleF ImageRectForContentRect(RectangleF rect)
        {
            return new RectangleF(0, 6, 29, 28);
        }
    }

SIGSEGVs


Stacktrace:

  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSendSuper_RectangleF (intptr,intptr,System.Drawing.RectangleF) <IL 0x00025, 0xffffffff>
  at MonoTouch.UIKit.UIView.set_Frame (System.Drawing.RectangleF) [0x00021] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIView.g.cs:1172
  at Moonfruit.UI.Stream.MoonfruitStreamViewController.InitializeUi () [0x000df] in /Users/jamie/binaryfinery/monodev/moonfruit/Moonfruit/UI/Stream/MoonfruitStreamViewController.cs:46
  at BinaryFinery.Touch.Components.Controllers.CompoundController.CreateView () [0x000e8] in /Users/jamie/binaryfinery/monodev/moonfruit/binaryfinery-touch/BinaryFinery.Touch/Components/Controllers/CompondController.cs:94
  at BinaryFinery.Touch.Components.Controllers.CompoundController.LoadView () [0x0000b] in /Users/jamie/binaryfinery/monodev/moonfruit/binaryfinery-touch/BinaryFinery.Touch/Components/Controllers/CompondController.cs:70
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>
  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_bool (intptr,intptr,intptr,bool) <IL 0x0002e, 0xffffffff>
  at MonoTouch.UIKit.UINavigationController.PushViewController (MonoTouch.UIKit.UIViewController,bool) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UINavigationController.g.cs:129
  at BinaryFinery.Touch.Components.Activities.ActivityStack.PushActivity (BinaryFinery.Touch.Components.Activities.Intent,BinaryFinery.Touch.Components.Activities.Activity) [0x00084] in /Users/jamie/binaryfinery/monodev/moonfruit/binaryfinery-touch/BinaryFinery.Touch/Components/Activities/ActivityStack.cs:192
  at BinaryFinery.Touch.Components.Activities.ActivityStack.PushActivity (BinaryFinery.Touch.Components.Activities.Activity) [0x0000d] in /Users/jamie/binaryfinery/monodev/moonfruit/binaryfinery-touch/BinaryFinery.Touch/Components/Activities/ActivityStack.cs:171
  at BinaryFinery.Touch.Components.Activities.Activity.StartActivity (BinaryFinery.Touch.Components.Activities.Activity) [0x00000] in /Users/jamie/binaryfinery/monodev/moonfruit/binaryfinery-touch/BinaryFinery.Touch/Components/Activities/Activity.cs:101
  at BinaryFinery.Touch.Components.Controllers.CompoundController.StartActivity (BinaryFinery.Touch.Components.Activities.Activity) [0x00000] in /Users/jamie/binaryfinery/monodev/moonfruit/binaryfinery-touch/BinaryFinery.Touch/Components/Controllers/CompondController.cs:207
  at Moonfruit.UI.SiteViewController.OnWhatsNewButtonPressed (object,System.EventArgs) [0x00000] in /Users/jamie/binaryfinery/monodev/moonfruit/Moonfruit/UI/Sites/SiteViewController.cs:101
  at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>
  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 Moonfruit.Application.Main (string[]) [0x00016] in /Users/jamie/binaryfinery/monodev/moonfruit/Moonfruit/Main.cs:31
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

	0   Moonfruit                           0x000e3c38 mono_handle_native_sigsegv + 408
	1   Moonfruit                           0x000149bf mono_sigsegv_signal_handler + 351
	2   libSystem.B.dylib                   0x9641d05b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   Moonfruit                           0x002ec7ea monotouch_x86_double_abi_stret_trampoline + 144
	5   UIKit                               0x0174ad5b -[UIButton(UIButtonInternal) _setupImageView] + 158
	6   UIKit                               0x0174a5f8 -[UIButton layoutSubviews] + 693
	7   UIKit                               0x0157b322 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 178
	8   CoreFoundation                      0x02803e72 -[NSObject performSelector:withObject:] + 66
	9   QuartzCore                          0x0262d92d -[CALayer layoutSublayers] + 266
	10  QuartzCore                          0x02637827 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 231
	11  QuartzCore                          0x02637922 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 43
	12  UIKit                               0x01574f47 -[UIView(Hierarchy) layoutBelowIfNeeded] + 42
	13  UIKit                               0x01748450 -[UIButton setFrame:] + 183
	14  ???                                 0x101b7c80 0x0 + 270236800
	15  ???                                 0x101b7ba4 0x0 + 270236580
	16  ???                                 0x157a60ff 0x0 + 360341759
	17  ???                                 0x150907d5 0x0 + 352913365
	18  ???                                 0x150902cc 0x0 + 352912076
	19  ???                                 0x09f32ec8 0x0 + 166932168
	20  Moonfruit                           0x0001470f mono_jit_runtime_invoke + 1407
	21  Moonfruit                           0x00222d3a mono_runtime_invoke + 170
	22  Moonfruit                           0x002f1125 monotouch_trampoline + 3381
	23  UIKit                               0x016025cb -[UIViewController view] + 53
	24  UIKit                               0x01602941 -[UIViewController contentScrollView] + 36
	25  UIKit                               0x0161447d -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
	26  UIKit                               0x0161466f -[UINavigationController _layoutViewController:] + 43
	27  UIKit                               0x0161493b -[UINavigationController _startTransition:fromViewController:toViewController:] + 303
	28  UIKit                               0x016153df -[UINavigationController _startDeferredTransitionIfNeeded] + 288
	29  UIKit                               0x01615986 -[UINavigationController pushViewController:transition:forceImmediate:] + 989
	30  UIKit                               0x016155a4 -[UINavigationController pushViewController:animated:] + 62
	31  ???                                 0x12ff74e9 0x0 + 318731497
	32  ???                                 0x12ff738c 0x0 + 318731148
	33  ???                                 0x12ff4ec0 0x0 + 318721728
	34  ???                                 0x12ff4b0c 0x0 + 318720780
	35  ???                                 0x157a4ff8 0x0 + 360337400
	36  ???                                 0x157a4fa0 0x0 + 360337312
	37  ???                                 0x157a4c1c 0x0 + 360336412
	38  ???                                 0x157a4b92 0x0 + 360336274
	39  ???                                 0x09f32ec8 0x0 + 166932168
	40  Moonfruit                           0x0001470f mono_jit_runtime_invoke + 1407
	41  Moonfruit                           0x00222d3a mono_runtime_invoke + 170
	42  Moonfruit                           0x002f1125 monotouch_trampoline + 3381
	43  CoreFoundation                      0x02803ec9 -[NSObject performSelector:withObject:withObject:] + 73
	44  UIKit                               0x0153f5c2 -[UIApplication sendAction:to:from:forEvent:] + 96
	45  UIKit                               0x0153f55a -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
	46  UIKit                               0x015e4b76 -[UIControl sendAction:to:forEvent:] + 66
	47  UIKit                               0x015e503f -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
	48  UIKit                               0x015e42fe -[UIControl touchesEnded:withEvent:] + 549
	49  UIKit                               0x01564a30 -[UIWindow _sendTouchesForEvent:] + 513
	50  UIKit                               0x01564c56 -[UIWindow sendEvent:] + 273
	51  UIKit                               0x0154b384 -[UIApplication sendEvent:] + 464
	52  UIKit                               0x0153eaa9 _UIApplicationHandleEvent + 8196
	53  GraphicsServices                    0x03f1cfa9 PurpleEventCallback + 1274
	54  CoreFoundation                      0x027d61c5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
	55  CoreFoundation                      0x0273b022 __CFRunLoopDoSource1 + 146
	56  CoreFoundation                      0x0273990a __CFRunLoopRun + 2218
	57  CoreFoundation                      0x02738db4 CFRunLoopRunSpecific + 212
	58  CoreFoundation                      0x02738ccb CFRunLoopRunInMode + 123
	59  GraphicsServices                    0x03f1b879 GSEventRunModal + 207
	60  GraphicsServices                    0x03f1b93e GSEventRun + 114
	61  UIKit                               0x0153ca9b UIApplicationMain + 1175
	62  ???                                 0x0f6d7e35 0x0 + 258833973
	63  ???                                 0x0f6d5968 0x0 + 258824552
	64  ???                                 0x0f363d60 0x0 + 255212896
	65  ???                                 0x0f363ed6 0x0 + 255213270
	66  Moonfruit                           0x0001470f mono_jit_runtime_invoke + 1407
	67  Moonfruit                           0x00222d3a mono_runtime_invoke + 170
	68  Moonfruit                           0x00225a71 mono_runtime_exec_main + 705
	69  Moonfruit                           0x00224c81 mono_runtime_run_main + 929
	70  Moonfruit                           0x000b02ff mono_jit_exec + 239
	71  Moonfruit                           0x00005f4a main + 5194
	72  Moonfruit                           0x000032c5 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.
=================================================================

Comment out the ImageRectForContentRect and it doesnt crash.