aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2015-08-22 08:20:53 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2015-08-22 08:20:53 +1000
commita8bc9f5af423f960d5725f26cbcd2dd63e4adcba (patch)
tree3e53b4f95065567e80ffe5cb8cdd8183f91fe70a
parent2575ce375ad71f349ef34b93c235f39648b82e6d (diff)
downloadscintilla-mirror-a8bc9f5af423f960d5725f26cbcd2dd63e4adcba.tar.gz
Potential fix for bug [#1751]. Save and restore graphics state in case deleted context
was causing a crash.
-rw-r--r--cocoa/ScintillaCocoa.mm3
1 files changed, 3 insertions, 0 deletions
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;