bug-gnustep
[Top][All Lists]
Advanced

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

[bug #25869] Registering untyped selector mutates existing selector


From: Truls Becken
Subject: [bug #25869] Registering untyped selector mutates existing selector
Date: Sat, 14 Mar 2009 22:30:13 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030719 GranParadiso/3.0.7

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

                 Summary: Registering untyped selector mutates existing
selector
                 Project: GNUstep
            Submitted by: bogomipz
            Submitted on: Sat 14 Mar 2009 11:30:06 PM CET
                Category: Libraries
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

While working on library code for Étoilé, a strange situation was
encountered that may be caused by a bug in libobjc. The issue is with pointers
to the name strings in selectors changing unexpectedly.

A test case is shown below, where four -test messages all use the same typed
selector. An interleaved -valueForKey: message registers an untyped selector
with the same name. At that moment, the typed selector is modified to use the
same string pointer as the new untyped selector.

One would think that this should be the other way around. The newer selector
should use the same string as the existing one, not modify one that is already
registered.

This is using libobjc from the GNUstep Subversion repository at r28049.
GNUstep Base is from the same svn revision.


$ cat GNUmakefile
include $(GNUSTEP_MAKEFILES)/common.make

TOOL_NAME = test

${TOOL_NAME}_OBJC_FILES = main.m

include $(GNUSTEP_MAKEFILES)/tool.make


$ cat main.m
#import <Foundation/Foundation.h>

@interface Foo : NSObject {}
- (void) test;
@end

@implementation Foo
- (void) test
{
        NSLog(@"%d %d %s %s", _cmd, sel_get_name(_cmd),
                sel_get_name(_cmd), sel_get_type(_cmd));
}
@end

int main (int argc, const char **argv)
{
        [NSAutoreleasePool new];

        id foo = [Foo new];

        [foo test];
        [foo test];
        [foo valueForKey: @"test"];
        [foo test];
        [foo test];

        return 0;
}


$ make
This is gnustep-make 2.0.8. Type 'make print-gnustep-make-help' for help.
Making all for tool test...
 Compiling file main.m ...
 Linking tool test ...

$ obj/test
2009-03-14 22:22:10.401 test[23586] 134520200 134519897 test v8@0:4
2009-03-14 22:22:10.406 test[23586] 134520200 134519897 test v8@0:4
2009-03-14 22:22:10.410 test[23586] 144773752 145449736 test (null)
2009-03-14 22:22:10.413 test[23586] 134520200 145449736 test v8@0:4
2009-03-14 22:22:10.416 test[23586] 134520200 145449736 test v8@0:4




    _______________________________________________________

Reply to this item at:

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

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





reply via email to

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