bug-gnustep
[Top][All Lists]
Advanced

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

[bug #24320] NSBundle accidentally initializes classes in framework link


From: Eric Wasylishen
Subject: [bug #24320] NSBundle accidentally initializes classes in framework linked to bundle
Date: Sat, 20 Sep 2008 23:11:01 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.2) Gecko/2008090211 Ubuntu/8.10 (intrepid) Firefox/3.0.1

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/





reply via email to

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