[Mono-bugs] [Bug 672616] New: MonoMac Bindings, app crashes when a textfield value is changed and in the binded object the method NSNumber.SByteValue is used in the binded property setter

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 16 11:29:11 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=672616

https://bugzilla.novell.com/show_bug.cgi?id=672616#c0


           Summary: MonoMac Bindings, app crashes when a textfield value
                    is changed and in the binded object the method
                    NSNumber.SByteValue is used in the binded property
                    setter
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: i386
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: br4ca at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development
           Blocker: Yes


Created an attachment (id=414457)
 --> (http://bugzilla.novell.com/attachment.cgi?id=414457)
C# MonoMac Project that reproduces this error

Description of Problem:
First, sorry but I was unable to find MonoMac category, so I've posted in this
one :(

Well, I'm using MonoMac bindings, to bind some textfields to objects
properties, in my case I have some NSNumber properties in my object, and in the
property setter, I have to convert the value (NSNumber) to a SByte value ir
order to make some things, to do this I'm using the property SByteValue of
NSNumber class, so I do something like: sbyte t = value.SByteValue;

Ex:
    public class TestClass : NSObject
    {
        [Export("CrashMe")]
        public NSNumber CrashMe
        {
            get
            {
                return NSNumber.FromSByte(1);    
            }
            set 
            {
                Console.WriteLine("SbyteValue = " + value.SByteValue);    
            }
        }
    }

The problem is, that the application crashes as soon as the binded property is
updated because the user changed the textfield value in the GUI

Steps to reproduce the problem:
1. Load the example attached to this bug report
2. Open the project in MonoDevelop (I'm using 2.4.2)
3. Start the project, a new Window will popup
4. Change the TextField value to something else, like 35
5. Press enter so the textfield value will be saved in the model..
6. You now have a crash :(


Actual Results:
Stacktrace:

  at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain
(int,string[]) <0x00003>
  at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain
(int,string[]) <0x00003>
  at MonoMac.AppKit.NSApplication.Main (string[]) <0x00015>
  at ErrorSample.MainClass.Main (string[]) <0x00015>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0x00073>

Native stacktrace:

    0   ErrorSample                         0x000c96ef
mono_handle_native_sigsegv + 343
    1   ErrorSample                         0x00010519
mono_sigsegv_signal_handler + 306
    2   libSystem.B.dylib                   0x93de246b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   ???                                 0x013c8781 0x0 + 20744065
    5   ???                                 0x02f0e388 0x0 + 49341320
    6   Foundation                          0x99183c71
_NSSetObjectValueAndNotify + 290
    7   Foundation                          0x99177018
-[NSObject(NSKeyValueCoding) setValue:forKey:] + 420
    8   Foundation                          0x99193b17
-[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 445
    9   AppKit                              0x926ba168 -[NSObjectController
_setSingleValue:forKeyPath:] + 299
    10  Foundation                          0x99193af3
-[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 409
    11  AppKit                              0x925c7e2e -[NSBinder
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
+ 461
    12  AppKit                              0x925c7c08 -[NSBinder
setValue:forBinding:error:] + 279
    13  AppKit                              0x92ae4636 -[NSValueBinder
_applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
+ 230
    14  AppKit                              0x92ae441b -[NSValueBinder
applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
+ 593
    15  AppKit                              0x92ae37c8 -[NSValueBinder
_applyDisplayedValueIfHasUncommittedChangesWithHandleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
+ 141
    16  AppKit                              0x926b7375 -[NSValueBinder
validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:] +
498
    17  AppKit                              0x926b716c -[_NSBindingAdaptor
_validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:bindingAdaptor:]
+ 179
    18  AppKit                              0x926b70a1 -[_NSBindingAdaptor
validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:] +
338
    19  AppKit                              0x926a0990 -[NSTextField
textShouldEndEditing:] + 438
    20  AppKit                              0x92644b71 -[NSTextView(NSSharing)
resignFirstResponder] + 534
    21  AppKit                              0x924a5997 -[NSWindow
makeFirstResponder:] + 366
    22  AppKit                              0x926a060a -[NSTextView(NSPrivate)
_giveUpFirstResponder:] + 313
    23  AppKit                              0x926a04c6
-[NSTextView(NSKeyBindingCommands) insertNewline:] + 531
    24  AppKit                              0x926a0200 -[NSResponder
doCommandBySelector:] + 77
    25  AppKit                              0x9269fb1b -[NSTextView
doCommandBySelector:] + 240
    26  AppKit                              0x9268ea37
-[NSKeyBindingManager(NSKeyBindingManager_MultiClients)
interpretEventAsCommand:forClient:] + 1911
    27  AppKit                              0x926922eb -[NSTextInputContext
handleEvent:] + 1604
    28  AppKit                              0x9268e0a1 -[NSView
interpretKeyEvents:] + 209
    29  AppKit                              0x92691b71 -[NSTextView keyDown:] +
751
    30  AppKit                              0x925c2d38 -[NSWindow sendEvent:] +
5757
    31  AppKit                              0x924db817 -[NSApplication
sendEvent:] + 6431
    32  AppKit                              0x9246f2a7 -[NSApplication run] +
917
    33  AppKit                              0x924672d9 NSApplicationMain + 574
    34  ???                                 0x02f0e85e 0x0 + 49342558
    35  ???                                 0x02f0e7ae 0x0 + 49342382
    36  ???                                 0x004cfd9e 0x0 + 5045662
    37  ???                                 0x004cfe34 0x0 + 5045812
    38  ErrorSample                         0x000102e4 mono_jit_runtime_invoke
+ 1339
    39  ErrorSample                         0x001df415 mono_runtime_invoke +
138
    40  ErrorSample                         0x001e15c0 mono_runtime_exec_main +
669
    41  ErrorSample                         0x001e09aa mono_runtime_run_main +
814
    42  ErrorSample                         0x0009cd1e mono_jit_exec + 200
    43  ErrorSample                         0x0009cf58 main_thread_handler +
558
    44  ErrorSample                         0x0009f28f mono_main + 7577
    45  ErrorSample                         0x00004009 mono_main_with_options +
539
    46  ErrorSample                         0x00004090 main + 49
    47  ErrorSample                         0x00003dc2 start + 54

Debug info from gdb:

/tmp/mono-gdb-commands.NwZkhf:1: Error in sourced command file:
unable to debug self

=================================================================
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.
=================================================================

Expected Results:
SbyteValue = 35

How often does this happen? 
Always

Additional Information:

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list