discuss-gnustep
[Top][All Lists]
Advanced

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

Re: setValue:forKey broken for bool properties


From: David Chisnall
Subject: Re: setValue:forKey broken for bool properties
Date: Mon, 20 Jan 2014 09:07:44 -0800

This looks like a simple omission.  It's fairly uncommon to use the C99 _Bool 
type (for which bool is a typedef), rather than the Objective-C BOOL type, in 
Objective-C code.  It shouldn't be too difficult to fix, I think we just need 
an extra case in a couple of switch statements.

David

On 19 Jan 2014, at 11:48, Mathias Bauer <mathias_bauer@gmx.net> wrote:

> Hi,
> 
> the following simple program crashes because GSObjCSetVal in GSObjCRuntime.m 
> does not handle boolean values:
> 
>> #import <Foundation/Foundation.h>
>> 
>> @interface TestObject : NSObject
>> @property (nonatomic, assign) bool switcher;
>> @end
>> 
>> @implementation TestObject
>> @end
>> 
>> int main(int argc, const char * argv[])
>> {
>>    TestObject* test = [TestObject new];
>> 
>>    [test setValue:[NSNumber numberWithBool:YES] forKey:@"switcher"];
>>    return 0;
>> }
>> 
> 
> compiled with:
> clang `gnustep-config --objc-flags` -x objective-c -fobjc-arc -std=gnu99 
> -fpascal-strings -fstrict-aliasing -lobjc -lgnustep-base `gnustep-config 
> --objc-libs` test.m
> 
> I think this is a serious defect. On my system the type that needed to be 
> handled in GSObjCSetVal would be "B16", but on other system this might be 
> different.
> 
> I'm unsure about how a correct fix should be, so any opinions of people in 
> the know would be greatly appreciated.
> 
> Best regards,
> Mathias
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep




reply via email to

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