discuss-gnustep
[Top][All Lists]
Advanced

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

Re: has my bug report & fix been submitted (in NSProcessInfo.m)?


From: Lloyd Dupont
Subject: Re: has my bug report & fix been submitted (in NSProcessInfo.m)?
Date: Wed, 20 Jul 2005 15:35:28 +1000

thanks Richard!

I had to write a sample for you guys sop my fix get submitted (important to me) but it was quite tedious (due to the many C call I had to reproduce just to get there AND test it has failed.....)

I hope your explanation would simplify my work....

I see why development is so slow here.... (a no adverse effect, no perfomance cost, which could only produce only good or no result fix is hard thing to submit...)

----- Original Message ----- From: "Richard Frith-Macdonald" <richard@brainstorm.co.uk>
To: <discuss-gnustep@gnu.org>
Sent: Wednesday, July 20, 2005 2:58 PM
Subject: Re: has my bug report & fix been submitted (in NSProcessInfo.m)?


On 2005-07-19 15:18:19 +0100 Andrew Ruder <aeruder@ksu.edu> wrote:

Lloyd Dupont wrote:
here was the fix:
NSProcessInfo.m: 669
+ (void) initialize
{
   if (self == [NSProcessInfo class] && !_gnu_environment)
     _gnu_process_args(__argc, __argv, _environ);
}
I add the "&& !_gnu_environment" test

I don't think this could possibly be the correct fix. This is just duct-taping a fix over something else which is obviously broken... Aren't + initialize methods only supposed to be called once?

The 'self == [NSProcessInfo class]' clause is a standard/common thing ... to protect against the case where a subclass calls +initialize (yes, it can get called more than once ... it's just that the runtime guaranteese to call it once before calling other methods of the class).

The !_gnu_environment is the important bit ... to prevent _gnu_process_args(__argc, __argv, _environ) being called by +initialize if it has already been called. On windows, I think it is normally called in the fake main process, before +initialize is called.

I believe Lloyd needed to do this because he had initialised NSProcessInfo values with a custom version of the environment, and didn't want a later call to +initialize to overwrite stuff with environment information from the _environ global variable.

Basically, _gnu_process_args() can be called before +initialize, so it's good for +initialise to not call it again under those circumstances.




_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep





reply via email to

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