Actions
Bug #350
closedAssign property cause crash of application (Objective-C)
Start date:
05/07/2013
Due date:
% Done:
100%
Estimated time:
CPU Architecture:
all
Host OS:
Toolchain:
all
Android version:
CrystaX NDK Version:
Description
Code example is below:
@interface foo : BaseObject {
BOOL boolProperty;
id stringProperty;
}
@property (assign) BOOL boolProperty;
@property (copy) id stringProperty;
-(id) init;
-(void) bar;
@end
@implementation foo
@synthesize boolProperty;
@synthesize stringProperty;
- (void) bar
{
self.boolProperty = YES;
self.stringProperty = @"";
}
@end
Updated by Alexander Z. over 11 years ago
- Status changed from Open to In Progress
- % Done changed from 0 to 50
Updated by Dmitry M. over 10 years ago
- Target version changed from r8-crystax-2 to 10.0.0
Updated by Alexander Z. over 10 years ago
- Status changed from In Progress to Completed
- % Done changed from 0 to 100
Declaring property as 'copy' requires respective class to implement NSCoping protocol and thus implement copyWithZone method.
The issues's code example (slightly modified) compiled with GCC 4.6 correctly raises runtime exception (copyWithZone selector not found), but code compiled with GCC 4.8 or 4.9 just dumps core.
The described behavior can be reproduced on any Linux box with GCC Objective C compiler or Clang with GNU objc runtime.
To prevent application crash one needs either not declare property as 'copy' or implement copyWithZone method.
See test/device/crystax-issue-350-copy-with-zone sample code.
Actions