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: Fred Kiefer
Subject: Re: Crash on app start due to icon
Date: Sun, 5 Aug 2018 22:47:10 +0200


> 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().

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.

Wolfgangs fix is actually quite a good workaround for this.

Fred




reply via email to

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