URL:
  <http://savannah.gnu.org/bugs/?24320>

                 Summary: NSBundle accidentally initializes classes in
framework linked to bundle
                 Project: GNUstep
            Submitted by: ericw
            Submitted on: Sat 20 Sep 2008 11:10:59 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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 :)



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 20 Sep 2008 11:11:00 PM GMT  Name: NSBundle.patch  Size: 1kB   By:
ericw

<http://savannah.gnu.org/bugs/download.php?file_id=16534>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24320>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to