TShape component compiled with Cocoa WidgetSet crashes in TCocoaContext.SaveDC lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- freq · 2017-01-19 09:20 Hi, reported serious Cocoa problem here: http://bugs.freepascal.org/view.php?id=31253 I investigated already a couple of hours but need help now: Crash will happen on calling: ctx.saveGraphicsState; All components based on TCocoaCustomControl have this problem trying to draw its content in drawRect.  NSGraphicsContext.currentContext.saveGraphicsState; will also crash e.g. if one put this e.g. into TCocoaCustomControl.drawRect(dirtyRect: NSRect); But other NScalls from NSGraphicsContext like NSGraphicsContext.currentContext.isDrawingToScreen working. Are there any conditions for the NSGraphicsContext that has to be fullfilled before calling to saveGraphicsState is allowed? By the way: debugged with self compiled and signed gdb 1.12 from downloaded source code. Description here worked for me: https://sourceware.org/gdb/wiki/BuildingOnDarwin: ./configure make make install codesign -f -s "gdbcert" /usr/local/bin/gdb Thanks for any hint or fix. ---------------------------------------------------------------------- freq · 2017-01-22 10:35 In additional I created a couple of other Cocoa bug reports regarding hang and memory leaks: http://bugs.freepascal.org/view.php?id=31261 http://bugs.freepascal.org/view.php?id=31262 fyi: Fixed two cocoa issues in: Revision 53966 (memory leak) and 53942 (crash). Please review (e.g. sekelsenmat?) ---------------------------------------------------------------------- freq · 2017-02-05 06:55 Fixed in Revision 54092, please review. This fixes also other crashes in libraries that are used in hosts which are compiled with xcode >=8.0 (latest version of AppKit)