From a8bc9f5af423f960d5725f26cbcd2dd63e4adcba Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Sat, 22 Aug 2015 08:20:53 +1000 Subject: Potential fix for bug [#1751]. Save and restore graphics state in case deleted context was causing a crash. --- cocoa/ScintillaCocoa.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index b70975c28..e4117eb15 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1426,6 +1426,7 @@ void ScintillaCocoa::StartDrag() CGContextRef gcsw = sw->GetContext(); NSGraphicsContext *nsgc = [NSGraphicsContext graphicsContextWithGraphicsPort: gcsw flipped: YES]; + [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:nsgc]; CGContextTranslateCTM(gcsw, -client.left, -client.top); Paint(sw, client); @@ -1444,6 +1445,8 @@ void ScintillaCocoa::StartDrag() // XXX TODO: overwrite any part of the image that is not part of the // selection to make it transparent. right now we just use // the full rectangle which may include non-selected text. + + [NSGraphicsContext restoreGraphicsState]; } sw->Release(); delete sw; -- cgit v1.2.3