From ecd41af43d43ace633ccf2d53f3774161a793792 Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Tue, 6 Feb 2018 13:37:05 +0100 Subject: [PATCH] Fix Events causing crashes in autorelease (hopefully) fixes #141 (thanks to @mpw) Culprit: using lastSeenKeyBoardStrokeDetails sometimes with, sometimes without `self.`, thus confusing the retaincount done in the generated accessors. (lastSeenKeyBoardModifierDetails already did the right thing) --- platforms/iOS/vm/OSX/sqSqueakOSXCGView.m | 6 +++--- platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m b/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m index bc256c89be..af6adf6d33 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m @@ -339,7 +339,7 @@ -(void)keyDown:(NSEvent*)theEvent { NSArray *down = @[theEvent]; @synchronized(self) { - lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; + self.lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; [self interpretKeyEvents: down]; self.lastSeenKeyBoardStrokeDetails = NULL; } @@ -469,7 +469,7 @@ - (void)doCommandBySelector:(SEL)aSelector { keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]); aKeyBoardStrokeDetails.keyCode = keyCode; aKeyBoardStrokeDetails.modifierFlags = self.lastSeenKeyBoardModifierDetails.modifierFlags; - lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; + self.lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; [(sqSqueakOSXApplication *) gDelegateApp.squeakApplication recordCharEvent: unicodeString fromView: self]; self.lastSeenKeyBoardStrokeDetails = NULL; @@ -493,7 +493,7 @@ - (BOOL)performKeyEquivalent:(NSEvent *)theEvent { keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]); aKeyBoardStrokeDetails.keyCode = [theEvent keyCode]; aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags]; - lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; + self.lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; [(sqSqueakOSXApplication *) gDelegateApp.squeakApplication recordCharEvent: unicodeString fromView: self]; self.lastSeenKeyBoardStrokeDetails = NULL; diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m b/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m index 8d19676c06..21f5e1bc14 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m @@ -773,7 +773,7 @@ -(void)keyDown:(NSEvent*)theEvent { NSArray *down = @[theEvent]; @synchronized(self) { - lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; + self.lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; [self interpretKeyEvents: down]; self.lastSeenKeyBoardStrokeDetails = NULL; } @@ -900,7 +900,7 @@ - (void)doCommandBySelector:(SEL)aSelector { keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]); aKeyBoardStrokeDetails.keyCode = keyCode; aKeyBoardStrokeDetails.modifierFlags = self.lastSeenKeyBoardModifierDetails.modifierFlags; - lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; + self.lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; [(sqSqueakOSXApplication *) gDelegateApp.squeakApplication recordCharEvent: unicodeString fromView: self]; self.lastSeenKeyBoardStrokeDetails = NULL; @@ -924,7 +924,7 @@ - (BOOL)performKeyEquivalent:(NSEvent *)theEvent { keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]); aKeyBoardStrokeDetails.keyCode = [theEvent keyCode]; aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags]; - lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; + self.lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails; [(sqSqueakOSXApplication *) gDelegateApp.squeakApplication recordCharEvent: unicodeString fromView: self]; self.lastSeenKeyBoardStrokeDetails = NULL;