gnustep-dev
[Top][All Lists]
Advanced

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

Re: NSClassSwapper leaving dangling pointers?


From: Gregory Casamento
Subject: Re: NSClassSwapper leaving dangling pointers?
Date: Sun, 23 Jun 2013 19:39:54 -0400

I am going to set up darling to test this. I wrote nsclassswapper. 

On Saturday, June 22, 2013, Luboš Doležel wrote:

Hi,

I'm actually not porting the code - I'm writing a Wine-like emulation layer called Darling to run OS X apps directly. This fact makes debugging slightly more difficult, but you're welcome to take a look at http://github.com/LubosD/darling.

I find the bug straightforward, class swapping should happen before action/target binding, but I may be wrong indeed.

Germán, I'll mail a longer backtrace as soon as possible.

Luboš


Dne 22. června 2013 16:38:26 Eric Wasylishen napsal:

Hi Luboš,

I'm not too familiar with nib loading internals, but I will try to take a look. Could you  upload your work in progress code somewhere? (Or do you have any changes to the original Mac source?)

Cool idea to port the unarchiver. :-)

Cheers,
Eric

On Jun 21, 2013 11:30 AM, "Luboš Doležel" <address@hidden> wrote:
Hi,

I'm still working on getting the latest The Unarchiver for OS X <http://wakaba.c3.cx/s/apps/unarchiver.html> working under GNUstep/Darling/Linux and I'm seeing crashes after the application's NIB file is loaded.

Now I'm sort of helpless. The crash happens when using the target of a certain NSMenuItem.

You can see an excerpt of the relevant NIB's source here; the NSMenuItem clearly refers to the NSPopUpButtonCell that it is part of:

<object class="NSPopUpButtonCell" key="NSCell" id="824605593">
  <int key="NSCellFlags">-2076180416</int>
  <int key="NSCellFlags2">2048</int>
  <reference key="NSSupport" ref="170887875"/>
  <reference key="NSControlView" ref="790450297"/>
  <int key="NSButtonFlags">109199360</int>
  <int key="NSButtonFlags2">1</int>
  <reference key="NSAlternateImage" ref="538669737"/>
  <string key="NSAlternateContents"/>
  <object class="NSMutableString" key="NSKeyEquivalent">
    <characters key="NS.bytes"/>
  </object>
  <int key="NSPeriodicDelay">400</int>
  <int key="NSPeriodicInterval">75</int>

  <object class="NSMenuItem" key="NSMenuItem" id="444300673">
   <reference key="NSMenu" ref="552121880"/>
   <string key="NSTitle">dummy</string>
   <string key="NSKeyEquiv"/>
   <int key="NSKeyEquivModMask">1048576</int>
   <int key="NSMnemonicLoc">2147483647</int>
   <int key="NSState">1</int>
   <reference key="NSOnImage" ref="1019969751"/>
   <reference key="NSMixedImage" ref="16787521"/>
   <string key="NSAction">_popUpItemAction:</string>
   <reference key="NSTarget" ref="824605593"/>
  </object>

(Full code can be found in The Unarchiver's source tarball in MainMenu.nib/designable.nib)

I can see the target being set correctly via -setTarget upon loading:

Breakpoint 3, -[NSMenuItem setTarget:] (self=0x1845808, _cmd=0x7ffff7a51eb0 <.objc_selector_list+176>, anObject=0x1843d58) at NSMenuItem.m:465
465       if (_target == anObject)
(gdb) p anObject
$15 = (id) 0x1843d58
(gdb) p anObject->isa
$16 = (struct objc_class *) 0x7ffff7a6bcc0 <_OBJC_CLASS_NSPopUpButtonCell>

Backtrace:

#0  -[NSMenuItem setTarget:] (self=0x189de68, _cmd=0x7ffff79f7ce0 <.objc_selector_list+640>, anObject=0x1429f18) at NSMenuItem.m:465
#1  0x00007ffff745354e in -[NSNibControlConnector establishConnection] (self=0x189de38, _cmd=0x7ffff7afe330 <.objc_selector_list+1232>) at NSBundleAdditions.m:177
#2  0x00007ffff76cfb91 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] (self=0x14be778, _cmd=0x7ffff7afdf70 <.objc_selector_list+272>, owner=0xe67488,
    topLevelObjects=0x0) at GSNibLoading.m:1926
#3  0x00007ffff76cff26 in -[NSIBObjectData awakeWithContext:] (self=0x14be778, _cmd=0x7ffff7b1a170 <.objc_selector_list+176>, context=0xcb09f8) at GSNibLoading.m:1982
#4  0x00007ffff771028e in -[GSNibLoader loadModelData:externalNameTable:withZone:] (self=0xde8158, _cmd=0x7ffff7a56260 <.objc_selector_list+224>, data="" context=0xcb09f8,
    zone=0x329060bb38 <default_zone>) at GSNibLoader.m:87
#5  0x00007ffff753f57d in -[NSNib instantiateNibWithExternalNameTable:withZone:] (self=0xecf938, _cmd=0x7ffff79f7b00 <.objc_selector_list+160>, externalNameTable=0xcb09f8,
    zone=0x329060bb38 <default_zone>) at NSNib.m:153
#6  0x000



--
Gregory Casamento
Open Logic Corporation, Principal Consultant
yahoo/skype: greg_casamento, aol: gjcasa
(240)274-9630 (Cell)
http://www.gnustep.org
http://heronsperch.blogspot.com

reply via email to

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