bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation fault while loading Cocoa NIB


From: Andy Balholm
Subject: Re: Segmentation fault while loading Cocoa NIB
Date: Thu, 18 Jun 2009 12:50:58 -0700

Thank you for looking into this bug. Here is the source for the project as it was just before I removed the user defaults controller from CompanyInfo.nib.

Attachment: R2O.zip
Description: Zip archive



To show the Company Info window, select Edit Company Info... from the file menu (with a document open). To get the crash, close that window and then open it again.

As far as I know, no other objects in the NIB reference the user defaults controller.

I have also discovered another bug relating to this NIB. The bindings that it contains seem to be read-only; if there is data in the model objects, it is displayed, but any changes I make in the text fields are not reflected in the model.

Here's a sample data file too:

Attachment: Test.r2o
Description: Binary data




Andy Balholm
(509) 276-9718
andy@balholm.com



On Jun 18, 2009, at 12:37 PM, Fred Kiefer wrote:

Hi Andy,

thank you for the bug report and the analysis you did yourself. In
general it really helps to have the source code and of course the NIB
files to dig into such a problem.

The decoding code for NSUserDefaultsController is rather simple:

- (id) initWithCoder: (NSCoder *)aDecoder
{
 if ([aDecoder allowsKeyedCoding])
   if ([aDecoder decodeBoolForKey: @"NSSharedInstance"])
     {
       RELEASE(self);
       return [NSUserDefaultsController sharedUserDefaultsController];
     }

 return [super initWithCoder: aDecoder];
}

I don't expect that this itself is causing the problem. Maybe another
object is having a reference to this object and the code there doesn't
properly handle the case the the decoded object gets replaced by another
one. I would need to look at the NIB file (best in XML format) to
further analyse this.

Fred



Andy Balholm wrote:
I sent this message a while ago. Since then I investigated further with GDB and discovered that the segmentation fault happens while the shared
user defaults controller is being unarchived from the NIB. For this
particular program, the NIB didn't need to have a user defaults
controller in it. (IB put it in without asking.) But someone may want to
look into the problem in general.

There is also another crash that occurs only under FreeBSD, but not
under Windows, in the same circumstances. It says that virtual memory is
exhausted.

Andy Balholm
(509) 276-9718
andy@balholm.com



Begin forwarded message:

From: Andy Balholm <andy@balholm.com>
Date: June 16, 2009 4:29:48 PM PDT
To: bug-gnustep@gnu.org
Subject: Segmentation fault while loading Cocoa NIB

I am developing an application to run under MacOS and GNUstep. The
windows are stored as Cocoa NIBs. One of the windows causes a crash
the second or third time it loads when I'm running the program under
GNUstep for either Windows or FreeBSD. (The main document window is
fine, though.) It does not crash under MacOS, so I suppose it would be
considered a bug in GNUstep rather than in my program.

It doesn't seem to matter whether I save the NIB as format version 2
or format version 3 in Interface Builder. The crash still happens.

Under Windows, I'm using gnustep-core version 0.23.0. Under FreeBSD,
I'm using sources from Subversion downloaded on Saturday (Jun 13).

Here is the stack trace I got with gdb under FreeBSD:

#0  0x28865a64 in objc_msg_lookup () from /usr/lib/libobjc.so.3
#1 0x285c919d in GSIArraySetItemAtIndex (array=0x2933a900, item={addr
= 692693272, obj = 0x2949a918, nso = 0x2949a918}, index=115) at
GSIArray.h:502
#2  0x285c8d0e in -[NSKeyedUnarchiver(Private) _decodeObject:]
(self=0x28ece248, _cmd=0x28801ac8, index=115) at NSKeyedUnarchiver.m:226
#3  0x285c86c5 in -[NSKeyedUnarchiver(Internal)
_decodeArrayOfObjectsForKey:] (self=0x28ece248, _cmd=0x287ce5f8,
aKey=0x287cdad8) at NSKeyedUnarchiver.m:114
#4  0x284e5d4e in -[GSPlaceholderArray initWithCoder:]
(self=0x28d3b8d8, _cmd=0x28801b08, aCoder=0x28ece248) at GSArray.m: 1133
#5  0x285c8ca1 in -[NSKeyedUnarchiver(Private) _decodeObject:]
(self=0x28ece248, _cmd=0x28801ac8, index=121) at NSKeyedUnarchiver.m:219
#6  0x285cb8db in -[NSKeyedUnarchiver decodeObjectForKey:]
(self=0x28ece248, _cmd=0x2845e0b8, aKey=0x2845c450) at
NSKeyedUnarchiver.m:600
#7  0x283575ff in -[NSIBObjectData initWithCoder:] (self=0x28ecf928,
_cmd=0x28801b08, coder=0x28ece248) at GSNibLoading.m:1680
#8  0x285c8ca1 in -[NSKeyedUnarchiver(Private) _decodeObject:]
(self=0x28ece248, _cmd=0x28801ac8, index=1) at NSKeyedUnarchiver.m: 219
#9  0x285cb8db in -[NSKeyedUnarchiver decodeObjectForKey:]
(self=0x28ece248, _cmd=0x28469988, aKey=0x28469484) at
NSKeyedUnarchiver.m:600
#10 0x2836bbd4 in -[GSNibLoader
loadModelData:externalNameTable:withZone:] (self=0x28d75f28,
_cmd=0x284699d8, data=0x28eba668, context=0x28ecab88, zone=0x2883a320)
at GSNibLoader.m:73
#11 0x2836bf43 in -[GSNibLoader
loadModelFile:externalNameTable:withZone:] (self=0x28d75f28,
_cmd=0x283a49a0, fileName=0x28e1c828, context=0x28ecab88,
zone=0x2883a320) at GSNibLoader.m:133
#12 0x2816dd6f in +[NSBundle(NSBundleAdditions)
loadNibFile:externalNameTable:withZone:] (self=0x287e1da0,
_cmd=0x28434570, fileName=0x28e1c828, context=0x28ecab88,
zone=0x2883a320) at NSBundleAdditions.m:205
#13 0x282e8049 in -[NSWindowController loadWindow] (self=0x28e3b6a8,
_cmd=0x28434490) at NSWindowController.m:467
#14 0x282e75ea in -[NSWindowController window] (self=0x28e3b6a8,
_cmd=0x28434408) at NSWindowController.m:301
#15 0x282e70af in -[NSWindowController setDocumentEdited:]
(self=0x28e3b6a8, _cmd=0x283c02b0, flag=0 '\000') at
NSWindowController.m:210
#16 0x281aee29 in -[NSDocument addWindowController:] (self=0x28e1c588,
_cmd=0x804be00, windowController=0x28e3b6a8) at NSDocument.m:319
#17 0x08048e15 in -[MyDocument showCompanyInfoWindow:]
(self=0x28e1c588, _cmd=0x28d1ac08, sender=0x2939a1f8) at MyDocument.m:43
#18 0x286efa8f in L10 () from
/usr/GNUstep/System/Library/Libraries/libgnustep-base.so.1.19
#19 0x28e1c588 in ?? ()
#20 0x28d1ac08 in ?? ()
#21 0x2939a1f8 in ?? ()
#22 0x288710f0 in ?? () from /usr/lib/libobjc.so.3
#23 0x28e00000 in ?? ()
#24 0x0804f438 in ?? ()
#25 0x0804f540 in ?? ()
#26 0x2886aea0 in objc_free () from /usr/lib/libobjc.so.3
#27 0x286ae70d in GSFFCallInvokeWithTargetAndImp (_inv=0x28e48fd8,
anObject=0x28e1c588, imp=0x8048c60 <-[MyDocument
showCompanyInfoWindow:]>) at GSFFCallInvocation.m:709
#28 0x286aeaec in -[GSFFCallInvocation invokeWithTarget:]
(self=0x28e48fd8, _cmd=0x283977e8, anObject=0x28e1c588) at
GSFFCallInvocation.m:779
#29 0x2813dc3f in -[NSApplication sendAction:to:from:]
(self=0x28e1c4c8, _cmd=0x283e2dd0, aSelector=0x28d1ac08, aTarget=0x0,
sender=0x2939a1f8) at NSApplication.m:2087
#30 0x2820d871 in -[NSMenu performActionForItemAtIndex:]
(self=0x293d39c8, _cmd=0x283e5798, index=9) at NSMenu.m:1242
#31 0x282171d5 in -[NSMenuView trackWithEvent:] (self=0x293af6c8,
_cmd=0x283e5818, event=0x28e3b3d8) at NSMenuView.m:1633
#32 0x28217354 in -[NSMenuView mouseDown:] (self=0x293af6c8,
_cmd=0x28433190, theEvent=0x28e3b568) at NSMenuView.m:1678
#33 0x282df26e in -[NSWindow sendEvent:] (self=0x28d03a08,
_cmd=0x283977a0, theEvent=0x28e3b568) at NSWindow.m:3588
#34 0x2813d5dd in -[NSApplication sendEvent:] (self=0x28e1c4c8,
_cmd=0x283976e0, theEvent=0x28e3b568) at NSApplication.m:1963
#35 0x2813c019 in -[NSApplication run] (self=0x28e1c4c8,
_cmd=0x2838cc60) at NSApplication.m:1465
#36 0x2811b4c1 in NSApplicationMain (argc=1, argv=0xbfbfe824) at
Functions.m:74
#37 0x0804ac9e in main (argc=Error accessing memory address 0x160001:
Bad address.

I would be glad to send you the application source if it would help
you find the problem.

Andy Balholm
(509) 276-9718
andy@balholm.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]