View Issue Details

IDProjectCategoryView StatusLast Update
0031253LazarusLCLpublic2017-02-05 07:50
ReporteraccSoneAssigned ToaccSone 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.8Product Build 
Target Version1.8Fixed in Version1.8 
Summary0031253: Project with TShape component compiled with Cocoa WidgetSet crashes in TCocoaContext.SaveDC
DescriptionCrash will happen on calling: ctx.saveGraphicsState;

All components based on TCocoaCustomControl have this problem trying to draw its content in drawRect.

Investigations:

NSGraphicsContext.currentContext.saveGraphicsState; will also crash e.g. if one put this e.g. into TCocoaCustomControl.drawRect(dirtyRect: NSRect); Other NScalls from NSGraphicsContext like isDrawingToScreen working.
Steps To ReproduceCompile and run attached project with TShape component. Crash on launch. Remove TShape component. Form starts up as expected.
Additional InformationStacktrace:

#0 objc_msgSend at :0
0000001 SAVEDC(0x1009f62c0) at cocoa/cocoagdiobjects.pas:1586
0000002 SAVEDC(0x100e011b0, 4305412800) at cocoa/cocoawinapi.inc:2423
0000003 SAVEDC(4305412800) at include/winapi.inc:830
0000004 PAINTCONTROLS(0x100e2bd50, 4305412800, 0x0) at include/wincontrol.inc:4894
0000005 PAINTHANDLER(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, DC = 4305412800, PAINTSTRUCT = 0x100e42ac0, RESULT = 0}) at include/wincontrol.inc:4825
0000006 WMPAINT(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, DC = 4305412800, PAINTSTRUCT = 0x100e42ac0, RESULT = 0}) at include/wincontrol.inc:6756
0000007 WMPAINT(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, DC = 4305412800, PAINTSTRUCT = 0x100e42ac0, RESULT = 0}) at include/customcontrol.inc:106
0000008 DISPATCH(0x100e2bd50, 0) at ../inc/objpas.inc:602
0000009 WNDPROC(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, WPARAM = 4305412800, LPARAM = 4309920448, RESULT = 0}) at include/control.inc:2134
0000010 WNDPROC(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, WPARAM = 4305412800, LPARAM = 4309920448, RESULT = 0}) at include/wincontrol.inc:5379
0000011 WNDPROC(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, WPARAM = 4305412800, LPARAM = 4309920448, RESULT = 0}) at include/customform.inc:1475
0000012 DELIVERMESSAGE(0x100e2bd50, 0) at lclmessageglue.pas:112
0000013 LCLSENDPAINTMSG(0x100e2bd50, 4305412800, 0x100e42ac0) at lclmessageglue.pas:784
0000014 DRAW(0x100e42120, 0x100b50bf0, {ORIGIN = {X = 0, Y = 0}, SIZE = {WIDTH = 320, HEIGHT = 240}}, {ORIGIN = {X = 0, Y = 0}, SIZE = {WIDTH = 320, HEIGHT = 240}}) at cocoa/cocoawscommon.pas:1052
0000015 \"-[TCocoaCustomControl drawRect:]\"(0x100b0a9c0, 0x7fff87508311, {ORIGIN = {X = 0, Y = 0}, SIZE = {WIDTH = 320, HEIGHT = 240}}) at cocoa/cocoaprivate.pp:2148
0000016 -[NSView _drawRect:clip:] at :0
0000017 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] at :0
0000018 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] at :0
0000019 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] at :0
0000020 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] at :0
0000021 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] at :0
0000022 -[NSView displayIfNeeded] at :0
0000023 -[NSWindow displayIfNeeded] at :0
0000024 ___NSWindowGetDisplayCycleObserver_block_invoke6365 at :0
0000025 __37+[NSDisplayCycle currentDisplayCycle]_block_invoke at :0
0000026 CA::Transaction::run_commit_handlers(CATransactionPhase) at :0
0000027 CA::Context::commit_transaction(CA::Transaction*) at :0
0000028 CA::Transaction::commit() at :0
0000029 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) at :0
0000030 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ at :0
0000031 __CFRunLoopDoObservers at :0
0000032 CFRunLoopRunSpecific at :0
0000033 RunCurrentEventLoopInMode at :0
0000034 ReceiveNextEventCommon at :0
0000035 _BlockUntilNextEventMatchingListInModeWithFilter at :0
0000036 _DPSNextEvent at :0
0000037 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] at :0
0000038 APPPROCESSMESSAGES(0x100e011b0) at cocoa/cocoaobject.inc:96
0000039 HANDLEMESSAGE(0x100e00cf0) at include/application.inc:1266
0000040 RUNLOOP(0x100e00cf0) at include/application.inc:1403
0000041 APPRUN(0x100e011b0, {Proc = {procedure (POINTER)} 0x7fff5fbffc00, Self = 0x100e00cf0}) at cocoa/cocoaobject.inc:81
0000042 RUN(0x100e00cf0) at include/application.inc:1391
0000043 PASCALMAIN at project1.lpr:18
0000044 FPC_SYSTEMMAIN(1, 0x7fff5fbffc98, 0x7fff5fbffca8) at ../bsd/system.pp:310
0000045 start at :0
TagsNo tags attached.
Fixed in Revision54092
LazTarget1.8
WidgetsetCocoa
Attached Files

Activities

accSone

2017-01-19 10:06

developer  

Cocoa CustomControl Crash.zip (64,780 bytes)

accSone

2017-01-19 10:11

developer   ~0097591

By the way: debugged with compiled 1.12 version of gdb. Description here worked for me: https://sourceware.org/gdb/wiki/BuildingOnDarwin

Issue History

Date Modified Username Field Change
2017-01-19 10:06 accSone New Issue
2017-01-19 10:06 accSone File Added: Cocoa CustomControl Crash.zip
2017-01-19 10:11 accSone Note Added: 0097591
2017-01-19 11:12 accSone Severity minor => crash
2017-02-05 07:49 accSone Assigned To => accSone
2017-02-05 07:49 accSone Status new => assigned
2017-02-05 07:50 accSone Fixed in Revision => 54092
2017-02-05 07:50 accSone LazTarget - => 1.8
2017-02-05 07:50 accSone Status assigned => resolved
2017-02-05 07:50 accSone Fixed in Version => 1.8
2017-02-05 07:50 accSone Resolution open => fixed