discuss-gnustep
[Top][All Lists]
Advanced

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

Re: GNUMail - editing window crash


From: Fred Kiefer
Subject: Re: GNUMail - editing window crash
Date: Sun, 02 Feb 2014 23:25:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 02.02.2014 14:02, Riccardo Mottola wrote:
> Hi,
> 
> on Fred's advice, I was reorganizing GNUMails EditWindowController alloc
> and release.
> 
> Basically, previously, the GNUMail class alloc'd a controller and then
> forgot about it, relying that the controller auto-released by itself.
> 
> I now try to keep track of all controllers and release them by removing
> them from the controller array on window closure.
> 
> On Mac everything seems to work quite fine! On GNUstep I get this crash:
> 
> #0  0x29069c37 in objc_msgSend () from /usr/local/lib/libobjc.so.4.6
> #1  0x287d26a4 in -[NSApplication(Private) _targetForAction:window:] (
>     _cmd=0x28a74ae0, window=0x28a74918) at NSApplication.m:3891
> #2  0x287d27af in -[NSApplication(Private)
> _targetForAction:keyWindow:mainWindow:] (self=0x2b8b6638,
> _cmd=0x28a74a80, aSelector=<value optimized out>,
>     keyWindow=<value optimized out>, mainWindow=<value optimized out>)
>     at NSApplication.m:3936
> รน#3  0x287ceff3 in -[NSApplication targetForAction:] (self=0x2b8b6638,
>     _cmd=0x28a74590) at NSApplication.m:2297
> #4  0x287cef72 in -[NSApplication targetForAction:to:from:] (
>     self=<value optimized out>, _cmd=0x28aacd08,
>     theAction=<value optimized out>, theTarget=<value optimized out>,
>     sender=<value optimized out>) at NSApplication.m:2273
> #5  0x2887ccf1 in -[NSMenu update] (self=<value optimized out>,
>     _cmd=0x28aad060) at NSMenu.m:1157
> #6  0x2887cc03 in -[NSMenu update] (self=<value optimized out>,
>     _cmd=0x28a74a20) at NSMenu.m:1152
> #7  0x287d2973 in -[NSApplication(Private) _windowDidBecomeKey:] (
>     self=<value optimized out>, _cmd=0x28a747f0, notification=0x2be60ee8)
>     at NSApplication.m:3986
> #8  0x28d84df8 in -[NSObject performSelector:withObject:] (self=0x2b8b6638,
>     _cmd=<value optimized out>, aSelector=0x28a747f0, anObject=0x28a74918)
>     at NSObject.m:2046
> #9  0x28d76de1 in -[NSNotificationCenter _postAndRelease:] (
>     self=<value optimized out>, _cmd=0x2be60ee8,
>     notification=<value optimized out>) at NSNotificationCenter.m:1190
> #10 0x28d77328 in -[NSNotificationCenter
> postNotificationName:object:userInfo:]
>     (self=0x2b9ca098, _cmd=0x28ff2cb0, name=0x28b021a8, object=0x2bf2ec88,
>     info=0x0) at NSNotificationCenter.m:1250
> #11 0x28d7724e in -[NSNotificationCenter postNotificationName:object:] (
>     self=0x2b9ca098, _cmd=0x28af4748, name=0x28b021a8, object=0x2bf2ec88)
>     at NSNotificationCenter.m:1230
> #12 0x2893d427 in -[NSWindow becomeKeyWindow] (self=0x2bf2ec88,
>     _cmd=0x28af4d40) at NSWindow.m:1575
> #13 0x2893d874 in -[NSWindow makeKeyWindow] (self=<value optimized out>,
>     _cmd=0x28af4ce8) at NSWindow.m:1689
> #14 0x2893932b in -[NSWindow(GNUstepPrivate) _lossOfKeyOrMainWindow] (
>     self=<value optimized out>, _cmd=0x28af4ef0) at NSWindow.m:322
> #15 0x2893daef in -[NSWindow orderWindow:relativeTo:] (self=0x2bf31d48,
>     _cmd=0x28a6d0a0, otherWin=<value optimized out>) at NSWindow.m:1790
> #16 0x2893da08 in -[NSWindow orderOut:] (self=0x2bf31d48, _cmd=0x28af4d58,
>     sender=0x2bf31d48) at NSWindow.m:1744
> #17 0x2894134e in -[NSWindow close] (self=0x2bf31d48, _cmd=0x28af4140)
>     at NSWindow.m:2973
> #18 0x28941c1b in -[NSWindow performClose:] (self=0x2bf31d48,
> _cmd=0x28af4a80,
>     sender=0x2b8b6638) at NSWindow.m:3198
> #19 0x289445cc in -[NSWindow sendEvent:] (self=<value optimized out>,
>     _cmd=0x4ecb, theEvent=<value optimized out>) at NSWindow.m:4103
> 
> 
> What appears to happen is that it tries to get the first responder of
> the window, and then its delegate and crashes there, thus the window has
> no delegate anymore. In the debugger I tried to print out the window to
> know which one it is, but I get a sound crash, thus perhaps even the
> window isn't there anymore.
> 
> The delegate is set EditWindowController.m:213
> 
> Is there some difference between the NIB and the GS code? I do wonder.

And I wonder, why you are taking different Code paths for GNUstep and
MacOSX. Is there any difference? If not, just remove the hardcoded
GNUstep windows building and use the NIB files there as well.

Actually, I am really interested which of the special GNUstep code path
are needed and why.

> The delegate owns the, window, doesn't it? I am releasing the delegate.
> Why do I get in there?

That is a good question. A window controller sets its window to nil,
when it gets deallocated. This releases the window and should cut the
connection from the window to the controller. But only the connections
GNUstep knows about. If your code sets the controller as the delegate of
the window (Why do you do this? You don't seem to need it on MacOSX),
you will need to override the -setWindow: and clean out the delegate
when the window gets reset.

> The notifications comes from becoming key apparently, but I am closing
> the window, the key should become the main MailViewer!
> 
> In fact, if I don't have a mail viewer open and just open a compose
> window, I can close it.
> 
> I'm confused. Hints or help is appreciated. I hate when stuff works on
> the Mac and then fails on GS...

In that case, try to use the same code on both platforms :-)

Fred



reply via email to

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