bugGNUstep - Bugs: bug #24320, NSBundle accidentally initializes...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #24320: NSBundle accidentally initializes classes in framework linked to bundle

Submitted by:  Eric Wasylishen <ericw>
Submitted on:  Sat 20 Sep 2008 11:10:59 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sat 11 Oct 2008 06:34:42 AM UTC, comment #1:

Thanks ... well spotted/diagnosed.
I applied your solution.

Richard Frith-Macdonald <CaS>
Project Member
Sat 20 Sep 2008 11:10:59 PM UTC, original submission:

At the end of _addFrameworkFromClass: in NSBundle.m, there's this section for the case when the framework is linked to a bundle:

if (_loadingBundle != nil && _loadingBundle != bundle)
{
[_loadingBundle->_bundleClasses
removeObjectsInArray: bundle->_bundleClasses];
}

The problem is, I believe removeObjectsInArray: causes isEqual: to be sent to the classes, which then will cause +initialize to be sent to the classes. I'm pretty sure they shouldn't be initialized here, and in my case in a class's custom +initialize method there is a call to [NSBundle bundleForClass: ] which returned incorrect results because the removeObjectsInArray: method wasn't finished executing.

I attached a patch which accomplishes the same thing and compares the classes with ==, and this fixes my code (I was working on a UnitKit bundle to test Etoile's SmalltalkKit.). Hope this is a correct analysis / helps :)

Eric Wasylishen <ericw>
Project Member

 

Attached Files
file #16534:  NSBundle.patch added by ericw (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by ericw (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 11 Oct 2008 06:34:42 AM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat 20 Sep 2008 11:11:00 PM UTCericwAttached File-=>Added NSBundle.patch, #16534

    Back to the top


    Powered by Savane 3.1-cleanup1