VM Crash on Mac with Input Method ([Vm-dev] Re: [squeak-dev] RFB)

John McIntosh johnmci at smalltalkconsulting.com
Fri Sep 16 22:04:28 UTC 2016


Ok, we'll I"m not sure which version of the source code is being compiled
here, or how this is being done (Xcode project, cmd line script?)

First If the VM is compiled for 32bit it uses NON-ARC memory management, if
it is compiled for 64bit then it should be ARC aware.

The returnAndRemoveOldest is from the ancient Apple Queue.m/h which is ill
named and returns for ARC a retain count of one, which then requires the
RELEASEOBJ.


- (void) ioGetNextEvent: (sqInputEvent *) evt {

ioProcessEvents();

id event = [eventQueue returnAndRemoveOldest];

if (event) {

@autoreleasepool {

            [self processAsOldEventOrComplexEvent: event placeIn: evt];

        }

        RELEASEOBJ(event);

}

}


The use of the autoreleasepool here is for the iOS platform where a more
complex procedure occurs to return data from the touch data. For OSX it
just drops the bytes (length sizeof(sqInputEvent))into the given
sqInputEvent buffer for consumption by Smalltalk.


In general it just takes a possible object off the queue and pulls the data
bytes into a C structure for consumption. Under non-ARC the object is
retained within the Queue.m/h and has to be later released.  I think I
should take one of the more standard GCD queue examples and replace the
older logic in the near future.


- (void ) processAsOldEventOrComplexEvent: (id) event placeIn:
(sqInputEvent *) evt {

if ([event[0] intValue] == 1) {

[(NSData *)event[1] getBytes: evt length: sizeof(sqInputEvent)];

if (evt->type == EventTypeKeyboard) {

// NSLog(@"keyboard pc %i cc %i uc %i m %i",((sqKeyboardEvent
*)evt)->pressCode,((sqKeyboardEvent *) evt)->charCode,((sqKeyboardEvent *)
evt)->utf32Code,((sqKeyboardEvent *) evt)->modifiers);

}

return;

}

}

As for the crash. it appears when we are doing the self interpretedKeyEvents

-(void)keyDown:(NSEvent*)theEvent {

keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[
keyBoardStrokeDetails alloc] init]);

aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];

aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];

NSArray *down = @[theEvent];

@synchronized(self) {

lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;

[self interpretKeyEvents: down];

self.lastSeenKeyBoardStrokeDetails = NULL;

}

}



*which triggers a failure via...  *

>> 6   org.squeak.Squeak5.1.32.All-in-One 0x00130512
getCrashDumpFilenameInto + 82
>> 7   com.apple.CoreFoundation       0x98c2ddaf _CFAutoreleasePoolPop + 47


On saturday I"ll see if I can recreate it and see what might be causing it,
mind nothing comes to mind at the moment.



On Fri, Sep 16, 2016 at 10:16 AM, Tobias Pape <Das.Linux at gmx.de> wrote:

>
>
> On 16.09.2016, at 19:09, Yoshiki Ohshima <Yoshiki.Ohshima at acm.org> wrote:
>
> > On Fri, Sep 16, 2016 at 6:22 AM, Yoshiki Ohshima
> > <Yoshiki.Ohshima at acm.org> wrote:
> >> Would it be a feasible approach to try to use XCode (clang) Analyze?
> >
> > I got 9 errors from clang-checker.  One of those that looks most
> > suspicious is this one attached:
> >
> > Apparently just commenting the RELEASEOBJ line is not the right
> > thing... But does anybody has some ideas?
>
> Somewhere a RETAINOBJECT might be missing?
>
> Best regards
>         -Tobias
>
> >
> > --
> > -- Yoshiki
> > <event.png>
>
>


-- 
===========================================================================
John M. McIntosh. Corporate Smalltalk Consulting Ltd
https://www.linkedin.com/in/smalltalk
===========================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160916/19267e40/attachment-0001.htm


More information about the Vm-dev mailing list