discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Crash on app start due to icon


From: Gregory Casamento
Subject: Re: Crash on app start due to icon
Date: Sun, 5 Aug 2018 17:25:24 -0400

Fred,

On Sun, Aug 5, 2018 at 16:47 Fred Kiefer <fredkiefer@gmx.de> wrote:


> Am 05.08.2018 um 22:26 schrieb Gregory Casamento <greg.casamento@gmail.com>:
>
> On Sun, Aug 5, 2018 at 05:27 Wolfgang Lux <wolfgang.lux@gmail.com> wrote:
>
> I finally managed to reproduce the crash, once I've noticed that you are compiling on a 32-bit OS rather than 64-bits (any reason for not using 64-bits nowadays?). Setting a breakpoint on the setApplicationIconImage: and then stepping through that method I found that the code crashes here:
> 2385      miniWindowSize = [GSCurrentServer() iconSize];
>
> And stepping into that method the problem is that GSCurrentServer() return a null pointer. I've committed a fix now to handle this case.
>
> Why on earth is GSCurrentServer() returning null? 

Because somebody (hint: you) did change the order in which this methods get called. If you have a look at the NSApplication _init method you will see that the backend gets initialised first and then the current display server is set. This order is needed as the display server is defined by the backend. Now you did move the loading of the application icon before that and there we use the setApplicationIcon: method which refers to the GSCurrentServer().

Oh damn.  I actually thought I was preserving the order when I made the change.  The issue I was seeing with getting the icon was caused by the fact that we needed to initialize the backend first before getting the icon.  This is why I split it out into two methods. 

My attempt to lazy load the icon only when it is needed didn’t help here, as actually this gets called from the backend when it is being initialised, which is still before the current display server is set.

The important bit here are these lines:

srv = [GSDisplayServer serverWithAttributes: nil];
RETAIN(srv);
[GSDisplayServer setCurrentServer: srv];

Only after the third one the current server is set, but the code triggered from the first line will call the applicationIcon method for the WindowMaker dock.

Okay. 



Wolfgangs fix is actually quite a good workaround for this.

I’m surprised neither of us picked this up on review.

Thanks Fred, Riccardo and Wolfgang. 


Fred

Yours, GC
--
Gregory Casamento
GNUstep Lead Developer / OLC, Principal Consultant
http://www.gnustep.org - http://heronsperch.blogspot.com
http://ind.ie/phoenix/

reply via email to

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