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

Group
 
 

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

Submitter:  Eric Wasylishen <ericw>
Submitted:  Sat 20 Sep 2008 11:10:59 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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

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

Richard Frith-Macdonald <CaS>
Group 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>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

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
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by ericw (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-10-11 CaS StatusNone Fixed
        Open/ClosedOpen Closed
    2008-09-20 ericw Attached File- Added NSBundle.patch, #16534

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code