---------- Forwarded message ----------
From: Tobias Pape <[email protected]>
Date: Mon, May 29, 2017 at 12:09 AM
Subject: Re: [Vm-dev] multiple crashes on macOS Sierra
To: John McIntosh <[email protected]>
Cc: Squeak Virtual Machine Development Discussion <
[email protected]>



Hi John, all


> On 28.05.2017, at 22:12, John McIntosh <[email protected]>
wrote:
>
> At commit point d0e7bfa0f8d99b856d9ac56372f7dacecdd63106  (5/5/17) Tobias
added
>
>
>         NSEvent* syntheticEvent = AUTORELEASEOBJ([NSEvent
keyEventWithType:(isUp ? NSEventTypeKeyUp : NSEventTypeKeyDown)
>
 location:[theEvent locationInWindow]
>
modifierFlags:(isUp ? oldFlags : [theEvent modifierFlags])
>
timestamp:[theEvent timestamp]
>
 windowNumber:[theEvent windowNumber]
>
context:nil
>
 characters:@""
>
charactersIgnoringModifiers:@""
>
isARepeat:NO
>
keyCode:[theEvent keyCode]]);
>
> in sqSqueakOSXOpenGLView.m  at - (void)flagsChanged:(NSEvent *)theEvent

That's correct.

>
> However I believe this is incorrect as the NSEvent class side method is
by the old non-arc memory rules implicitly an autoreleased object, so doing
the AUTORELEASEOBJ() might cause side effects.  https://developer.apple.com/
library/content/documentation/Cocoa/Conceptual/MemoryMgmt/
Articles/mmRules.html
>
> + (NSEvent *)keyEventWithType:(NSEventType)type
location:(NSPoint)location modifierFlags:(NSEventModifierFlags)flags
timestamp:(NSTimeInterval)time windowNumber:(NSInteger)wNum
context:(NSGraphicsContext *)unusedPassNil characters:(NSString *)keys
charactersIgnoringModifiers:(NSString *)ukeys isARepeat:(BOOL)flag
keyCode:(unsigned short)code;

Well, I have not found a reference to how this relates to autorelease (the
Apple docs are becoming increasingly useless these days :()
I read this https://developer.apple.com/reference/appkit/nsevent/
1533943-keyeventwithtype?language=objc
and the header /System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h
and although autorelase pops up somewhere in the file, it does not
somewhere near the declaration.
I read through the code an found quite a few  AUTORELEASEOBJ() around
object creation and (apparently wrongly) thought I would need that here.


I now understand that I should only autorelease alloc/inited stuff.

So you may be right here.

Fixed in 0f07ffbed

Best regards
        -Tobias

>
> If Tobias can verify and submit a change we can see if that affects the
behaviour we have been observing. Note that I"ve not been able to recreate
the problem, but in eyeballing the code this leaps out as suspect.

[snip]

Reply via email to