Project

General

Profile

Bug #350

Assign property cause crash of application (Objective-C)

Added by Dmitry Moskalchuk over 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
High
Category:
-
Target version:
Start date:
05/07/2013
Due date:
% Done:

100%

Estimated time:
CPU Architecture:
all
Host OS:
Toolchain:
all
Android version:
CrystaX 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

#1

Updated by Dmitry Moskalchuk over 7 years ago

  • Assignee set to Alexander Zhukov
#2

Updated by Alexander Zhukov over 7 years ago

  • Status changed from Open to In Progress
  • % Done changed from 0 to 50
#3

Updated by Dmitry Moskalchuk about 6 years ago

  • Target version changed from r8-crystax-2 to 10.0.0
#4

Updated by Alexander Zhukov almost 6 years ago

  • Status changed from In Progress to Closed
  • % 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.

Also available in: Atom PDF