Project with TShape component compiled with Cocoa WidgetSet crashes in TCocoaContext.SaveDC
Original Reporter info from Mantis: accSone
-
Reporter name:
Original Reporter info from Mantis: accSone
- Reporter name:
Description:
Crash 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 reproduce:
Compile and run attached project with TShape component. Crash on launch. Remove TShape component. Form starts up as expected.
Additional information:
Stacktrace:
#0 objc_msgSend at :0
#1 SAVEDC(0x1009f62c0) at cocoa/cocoagdiobjects.pas:1586
#2 SAVEDC(0x100e011b0, 4305412800) at cocoa/cocoawinapi.inc:2423
#3 SAVEDC(4305412800) at include/winapi.inc:830
#4 PAINTCONTROLS(0x100e2bd50, 4305412800, 0x0) at include/wincontrol.inc:4894
#5 PAINTHANDLER(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, DC = 4305412800, PAINTSTRUCT = 0x100e42ac0, RESULT = 0}) at include/wincontrol.inc:4825
#6 WMPAINT(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, DC = 4305412800, PAINTSTRUCT = 0x100e42ac0, RESULT = 0}) at include/wincontrol.inc:6756
#7 WMPAINT(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, DC = 4305412800, PAINTSTRUCT = 0x100e42ac0, RESULT = 0}) at include/customcontrol.inc:106
#8 DISPATCH(0x100e2bd50, 0) at ../inc/objpas.inc:602
#9 WNDPROC(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, WPARAM = 4305412800, LPARAM = 4309920448, RESULT = 0}) at include/control.inc:2134
#10 WNDPROC(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, WPARAM = 4305412800, LPARAM = 4309920448, RESULT = 0}) at include/wincontrol.inc:5379
#11 WNDPROC(0x100e2bd50, {MSG = 15, UNUSEDMSG = 0, WPARAM = 4305412800, LPARAM = 4309920448, RESULT = 0}) at include/customform.inc:1475
#12 DELIVERMESSAGE(0x100e2bd50, 0) at lclmessageglue.pas:112
#13 LCLSENDPAINTMSG(0x100e2bd50, 4305412800, 0x100e42ac0) at lclmessageglue.pas:784
#14 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
#15 \"-[TCocoaCustomControl drawRect:]\"(0x100b0a9c0, 0x7fff87508311, {ORIGIN = {X = 0, Y = 0}, SIZE = {WIDTH = 320, HEIGHT = 240}}) at cocoa/cocoaprivate.pp:2148
#16 -[NSView _drawRect:clip:] at :0
#17 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] at :0
#18 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] at :0
#19 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] at :0
#20 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] at :0
#21 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] at :0
#22 -[NSView displayIfNeeded] at :0
#23 -[NSWindow displayIfNeeded] at :0
#24 ___NSWindowGetDisplayCycleObserver_block_invoke6365 at :0
#25 __37+[NSDisplayCycle currentDisplayCycle]_block_invoke at :0
#26 CA::Transaction::run_commit_handlers(CATransactionPhase) at :0
#27 CA::Context::commit_transaction(CA::Transaction*) at :0
#28 CA::Transaction::commit() at :0
#29 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) at :0
#30 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ at :0
#31 __CFRunLoopDoObservers at :0
#32 CFRunLoopRunSpecific at :0
#33 RunCurrentEventLoopInMode at :0
#34 ReceiveNextEventCommon at :0
#35 _BlockUntilNextEventMatchingListInModeWithFilter at :0
#36 _DPSNextEvent at :0
#37 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] at :0
#38 APPPROCESSMESSAGES(0x100e011b0) at cocoa/cocoaobject.inc:96
#39 HANDLEMESSAGE(0x100e00cf0) at include/application.inc:1266
#40 RUNLOOP(0x100e00cf0) at include/application.inc:1403
#41 APPRUN(0x100e011b0, {Proc = {procedure (POINTER)} 0x7fff5fbffc00, Self = 0x100e00cf0}) at cocoa/cocoaobject.inc:81
#42 RUN(0x100e00cf0) at include/application.inc:1391
#43 PASCALMAIN at project1.lpr:18
#44 FPC_SYSTEMMAIN(1, 0x7fff5fbffc98, 0x7fff5fbffca8) at ../bsd/system.pp:310
#45 start at :0
Mantis conversion info:
- Mantis ID: 31253
- Version: 1.8
- Fixed in version: 1.8
- Fixed in revision: 54092 (#01a2998a)
- Target version: 1.8