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
commit7920429d70d2adc9abb22f793bf48546c5de150a (patch)
treededd3605b7fb92831c643e9e492bd0673000c664
parent802cb48712d849a9bfc5915737ad5bf88ad7da40 (diff)
downloadscintilla-mirror-7920429d70d2adc9abb22f793bf48546c5de150a.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;