ccgus / CocoaScript

JavaScript + the Cocoa frameworks, and then ObjC brackets show up to party as well.
Other
618 stars 58 forks source link

Code Sketch - Newtime.jstalk example crashes #5

Open kjk opened 10 years ago

kjk commented 10 years ago

I'm running Cocoa Script Editor from inside XCode 5.0.2 on OS X 10.9.1

Simply running Code Sketch - Newtime.jstalk example crashes after a couple of seconds.

The callstack:

(lldb) thread backtrace
* thread #1: tid = 0x1488f1, 0x00007fff845fea0e JavaScriptCore`WTFCrash + 62, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0xbbadbeef)
    frame #0: 0x00007fff845fea0e JavaScriptCore`WTFCrash + 62
    frame #1: 0x00007fff8464213b JavaScriptCore`JSC::JSCallbackObject<JSC::JSDestructibleObject>::call(JSC::ExecState*) + 811
    frame #2: 0x00007fff844e7426 JavaScriptCore`cti_op_call_NotJSFunction + 118
    frame #3: 0x0000533f54a01429
    frame #4: 0x00007fff843a33c3 JavaScriptCore`JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 595
    frame #5: 0x00007fff843a3165 JavaScriptCore`JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 69
    frame #6: 0x00007fff843a3085 JavaScriptCore`JSObjectCallAsFunction + 661
    frame #7: 0x000000010003ef5f CocoaScript`-[Mocha callJSFunction:withArgumentsInArray:](self=0x000062000006e340, _cmd=0x0000000100079c15, jsFunction=0x000000010b96f2b0, arguments=0x0000000000000000) + 335 at MochaRuntime.m:654
    frame #8: 0x0000000100045c5f CocoaScript`-[COScript callJSFunction:withArgumentsInArray:](self=0x00006200000784c0, _cmd=0x0000000100079c15, jsFunction=0x000000010b96f2b0, arguments=0x0000000000000000) + 111 at COScript.m:340
    frame #9: 0x0000000100028ca4 CocoaScript`-[COSCodeSketcher drawRect:](self=0x000000010031ab40, _cmd=0x00007fff8bb0e8d2, dirtyRect=NSRect at 0x00007fff5fbfc2f0) + 196 at COSCodeSketcher.m:228
    frame #10: 0x00007fff8b230399 AppKit`-[NSView _drawRect:clip:] + 3748
    frame #11: 0x00007fff8b22ec0e AppKit`-[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1799
    frame #12: 0x00007fff8b22ca50 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 841
    frame #13: 0x00007fff8b22df0e AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 6151
    frame #14: 0x00007fff8b22df0e AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 6151
    frame #15: 0x00007fff8b22c201 AppKit`-[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 314
    frame #16: 0x00007fff8b229209 AppKit`-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 2828
    frame #17: 0x00007fff8b20863a AppKit`-[NSView displayIfNeeded] + 1680
    frame #18: 0x00007fff8b26d89e AppKit`_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints + 884
    frame #19: 0x00007fff8b841cd1 AppKit`__83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke1331 + 46
    frame #20: 0x00007fff881e90a7 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    frame #21: 0x00007fff881e9017 CoreFoundation`__CFRunLoopDoObservers + 391
    frame #22: 0x00007fff881da7b8 CoreFoundation`__CFRunLoopRun + 776
    frame #23: 0x00007fff881da275 CoreFoundation`CFRunLoopRunSpecific + 309
    frame #24: 0x00007fff8393cf0d HIToolbox`RunCurrentEventLoopInMode + 226
    frame #25: 0x00007fff8393ccb7 HIToolbox`ReceiveNextEventCommon + 479
    frame #26: 0x00007fff8393cabc HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 65
    frame #27: 0x00007fff8b0d128e AppKit`_DPSNextEvent + 1434
    frame #28: 0x00007fff8b0d08db AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
    frame #29: 0x00007fff8b0c49cc AppKit`-[NSApplication run] + 553
    frame #30: 0x00007fff8b0af803 AppKit`NSApplicationMain + 940
    frame #31: 0x0000000100010b72 Cocoa Script Editor`main(argc=3, argv=0x00007fff5fbff640) + 34 at main.m:12
    frame #32: 0x00007fff85f6d5fd libdyld.dylib`start + 1
ccgus commented 10 years ago

I'm seeing that too. Lots of stuff changed in JS for 10.9, looks like it's biting me.

ccgus commented 10 years ago

Well, it no longer crashes - but it will if you try and print anything out in the draw function. I'm not sure why yet though… something tells me it's a race condition with GC.