[Mono-osx] SIGSEGV while saving in document-based app

Frank Krueger fak at kruegersystems.com
Tue May 24 14:09:50 EDT 2011


Hi everyone,

I have run into a bug in what I think is the runtime that is causing me some
real problems.

My app is document-based and I override the function GetAsData is order to
save.

public override NSData GetAsData (string documentType, out NSError outError)

{

try {

var circuitDump = "";


 if (Circuit != null) {

circuitDump = Circuit.DumpCircuit ();

}


 var data = NSMutableData.Create ();

data.AppendBytes (System.Text.Encoding.UTF8.GetBytes (circuitDump));


 outError = NSError.FromDomain (NSError.OsStatusErrorDomain, 0);

return data;

}  catch (Exception ex) {

Log.Error (ex);

outError = NSError.FromDomain (NSError.OsStatusErrorDomain, -4);

return null;

}

}

This works great for the 1st save. But if I try to save the document for a
second time (keep it open, and just hit "Save" a second time), I get the
crash pasted at the end of this message.

This is the last bug preventing me from releasing this app and I would
appreciate _any_ assistance anyone could provide. I am a bit desperate to
get this thing shipped so would be willing to pay someone to diagnose and
correct the error.

(My guess is that is has something to do with the "outError" parameter being
handled incorrectly. But it's just a guess.)


Stacktrace:

  at (wrapper managed-to-native)
MonoMac.ObjCRuntime.Messaging.intptr_objc_msgSend (intptr,intptr)
<0xffffffff>
  at MonoMac.ObjCRuntime.Runtime.GetNSObject (intptr) <0x000e5>
  at (wrapper dynamic-method)
object.[Circuit.Mac.CircuitDocument.MonoMac.Foundation.NSData
GetAsData(System.String, MonoMac.Foundation.NSError ByRef)]
(MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSString,intptr&)
<0x00031>
  at (wrapper native-to-managed)
object.[Circuit.Mac.CircuitDocument.MonoMac.Foundation.NSData
GetAsData(System.String, MonoMac.Foundation.NSError ByRef)]
(MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSString,intptr&)
<0xffffffff>
  at (wrapper managed-to-native)
MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0xffffffff>
  at MonoMac.AppKit.NSApplication.Main (string[]) <0x00017>
  at CircuitMac.MainClass.Main (string[]) <0x00019>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

0   iCircuit                            0x000b7009 0x0 + 749577
1   iCircuit                            0x0000704e 0x0 + 28750
2   libSystem.B.dylib                   0x98d7945b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   ???                                 0x13662c96 0x0 + 325463190
5   ???                                 0x012e6e5a 0x0 + 19820122
6   ???                                 0x017f8a74 0x0 + 25135732
7   AppKit                              0x9166c419 -[NSDocument
writeToURL:ofType:error:] + 865
8   AppKit                              0x9166832d -[NSDocument
writeToURL:ofType:forSaveOperation:originalContentsURL:error:] + 482
9   AppKit                              0x9166c71b -[NSDocument
_writeSafelyToURL:ofType:forSaveOperation:error:] + 271
10  AppKit                              0x9166b916 -[NSDocument
writeSafelyToURL:ofType:forSaveOperation:error:] + 422
11  AppKit                              0x91666856 -[NSDocument
saveToURL:ofType:forSaveOperation:error:] + 201
12  AppKit                              0x91669a95 -[NSDocument
_saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] +
71
13  AppKit                              0x91666ba4 -[NSDocument
saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] +
788
14  AppKit                              0x9166b38d -[NSDocument
_saveDocumentWithDelegate:didSaveSelector:contextInfo:] + 879
15  AppKit                              0x91666f59 -[NSDocument
saveDocumentWithDelegate:didSaveSelector:contextInfo:] + 354
16  AppKit                              0x9166702b -[NSDocument
saveDocument:] + 58
17  AppKit                              0x9134ac46 -[NSApplication
sendAction:to:from:] + 112
18  AppKit                              0x9134aaf9 -[NSMenuItem
_corePerformAction] + 435
19  AppKit                              0x9134a7eb -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] + 174
20  AppKit                              0x91446403 -[NSMenu
_performActionWithHighlightingForItemAtIndex:] + 49
21  AppKit                              0x91445baf -[NSMenu
performKeyEquivalent:] + 314
22  AppKit                              0x91444353 -[NSApplication
_handleKeyEquivalent:] + 581
23  AppKit                              0x9133a1f2 -[NSApplication
sendEvent:] + 4858
24  AppKit                              0x912ce2a7 -[NSApplication run] +
917
25  AppKit                              0x912c62d9 NSApplicationMain + 574
26  ???                                 0x027c66da 0x0 + 41707226
27  ???                                 0x027c6620 0x0 + 41707040
28  ???                                 0x003d4da2 0x0 + 4017570
29  ???                                 0x003d4e35 0x0 + 4017717
30  iCircuit                            0x000114e4 0x0 + 70884
31  iCircuit                            0x001bcca6 0x0 + 1821862
32  iCircuit                            0x001bf2a1 0x0 + 1831585
33  iCircuit                            0x001be68b 0x0 + 1828491
34  iCircuit                            0x00088662 0x0 + 558690
35  iCircuit                            0x00003ca6 0x0 + 15526
36  ???                                 0x00000001 0x0 + 1

Debug info from gdb:

/tmp/mono-gdb-commands.y62M4K: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.
=================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110524/b6713413/attachment-0001.html 


More information about the Mono-osx mailing list