Hi, I am not sure what is the status with this issue, but it seems clear that there exists a problem, so I opened an issue to accumulate the different opinions: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/141 Cheers, Doru
On May 29, 2017, at 9:53 PM, Eliot Miranda <eliot.miranda@gmail.com> wrote:
---------- Forwarded message ---------- From: Tobias Pape <Das.Linux@gmx.de> Date: Mon, May 29, 2017 at 12:09 AM Subject: Re: [Vm-dev] multiple crashes on macOS Sierra To: John McIntosh <johnmci@smalltalkconsulting.com> Cc: Squeak Virtual Machine Development Discussion <vm-dev@lists.squeakfoundation.org>
Hi John, all
On 28.05.2017, at 22:12, John McIntosh <johnmci@smalltalkconsulting.com> 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/M...
+ (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-keyeventwithtyp... 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]
-- www.tudorgirba.com www.feenk.com "Reasonable is what we are accustomed with."