Fixed bug #1027
Vittorio Giovara 2010-07-17 19:21:36 PDT fix the double free error in SDL_uikitview the variable 'textfield' is initialialized and set to autorelease. however in the dealloc method a second [release] is sent. If the textfield has not been set to nil before (with a viewDidUnload for example) this can lead to awful hard-to-find crashes when the SDL code terminates. the error message is -[textfield release] message sent to deallocated instance 0x4e5fa90 the fix is simple, just release the object as soon as it is added to the subview, see attached patch
This commit is contained in:
parent
6642f38cf1
commit
7a1c6519f4
1 changed files with 2 additions and 4 deletions
|
@ -35,9 +35,6 @@
|
||||||
@implementation SDL_uikitview
|
@implementation SDL_uikitview
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
#if SDL_IPHONE_KEYBOARD
|
|
||||||
[textField release];
|
|
||||||
#endif
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +217,7 @@
|
||||||
/* Set ourselves up as a UITextFieldDelegate */
|
/* Set ourselves up as a UITextFieldDelegate */
|
||||||
- (void)initializeKeyboard {
|
- (void)initializeKeyboard {
|
||||||
|
|
||||||
textField = [[[UITextField alloc] initWithFrame: CGRectZero] autorelease];
|
textField = [[UITextField alloc] initWithFrame: CGRectZero];
|
||||||
textField.delegate = self;
|
textField.delegate = self;
|
||||||
/* placeholder so there is something to delete! */
|
/* placeholder so there is something to delete! */
|
||||||
textField.text = @" ";
|
textField.text = @" ";
|
||||||
|
@ -238,6 +235,7 @@
|
||||||
keyboardVisible = NO;
|
keyboardVisible = NO;
|
||||||
/* add the UITextField (hidden) to our view */
|
/* add the UITextField (hidden) to our view */
|
||||||
[self addSubview: textField];
|
[self addSubview: textField];
|
||||||
|
[textField release];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reveal onscreen virtual keyboard */
|
/* reveal onscreen virtual keyboard */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue