Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2017-08-18 07:05:45 +0000
committerLakshmi Shanmugam2017-08-18 07:06:22 +0000
commitf28f8cb0510c91905751bee0f128e0912d8324c8 (patch)
treee5a4dc21a9cf65776de8ad8b6c5c240615c22751 /bundles/org.eclipse.swt/Eclipse SWT PI/cocoa
parentd60568a68b732473a302c525248b0c667707e8d4 (diff)
downloadeclipse.platform.swt-f28f8cb0510c91905751bee0f128e0912d8324c8.tar.gz
eclipse.platform.swt-f28f8cb0510c91905751bee0f128e0912d8324c8.tar.xz
eclipse.platform.swt-f28f8cb0510c91905751bee0f128e0912d8324c8.zip
Bug 508129 - [10.11]PaintEvent.GC.copyArea () crashes Eclipse Neon on
OSX 10.11 and above When a GC is created with a control as the Drawable and GC.copyArea() is called, a SWT.Paint event is sent unexpectedly. This happens because NSView.cacheDisplayInRect() calls drawRect() which causes a SWT.Paint event to be sent. The fix is to ignore this paint event and prevent SWT from sending it to the clients. This is handled by creating a custom callback for cacheDisplayInRect, setting the ignorePaint flag and then calling the Cocoa implementation of cacheDisplayInRect. The ignorePaint flag is reset after the call. Change-Id: I4c2e2986b83868082295ea187b543376bf4c8a7e
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/cocoa')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java2
4 files changed, 24 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
index b62f41243f..b1162fdf9a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
@@ -135,6 +135,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(CALLBACK_1attributedSubstringFromRange_1)
}
#endif
+#ifndef NO_CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1
+static jintLong CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1;
+static void proc_CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1(id arg0, SEL arg1, NSRect arg2, NSBitmapImageRep* arg3) {
+ ((void (*)(id, SEL, NSRect*, NSBitmapImageRep*))CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1)(arg0, arg1, &arg2, arg3);
+}
+static jintLong CALLBACK_cacheDisplayInRect_toBitmapImageRep_(jintLong func) {
+ CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1 = func;
+ return (jintLong)proc_CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1;
+}
+JNIEXPORT jintLong JNICALL OS_NATIVE(CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1_FUNC);
+ rc = (jintLong)CALLBACK_cacheDisplayInRect_toBitmapImageRep_(arg0);
+ OS_NATIVE_EXIT(env, that, CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_CALLBACK_1canDragRowsWithIndexes_1atPoint_1
static jintLong CALLBACK_1canDragRowsWithIndexes_1atPoint_1;
static BOOL proc_CALLBACK_1canDragRowsWithIndexes_1atPoint_1(id arg0, SEL arg1, NSIndexSet* arg2, NSPoint arg3) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
index bac2ebb6a5..951fa0111e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
@@ -23,6 +23,7 @@ char * OS_nativeFunctionNames[] = {
"CALLBACK_1NSTextAttachmentCell_1cellSize",
"CALLBACK_1accessibilityHitTest_1",
"CALLBACK_1attributedSubstringFromRange_1",
+ "CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1",
"CALLBACK_1canDragRowsWithIndexes_1atPoint_1",
"CALLBACK_1cellBaselineOffset",
"CALLBACK_1cellSize",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
index 3fcc56dfe6..b3aca449a3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
@@ -33,6 +33,7 @@ typedef enum {
CALLBACK_1NSTextAttachmentCell_1cellSize_FUNC,
CALLBACK_1accessibilityHitTest_1_FUNC,
CALLBACK_1attributedSubstringFromRange_1_FUNC,
+ CALLBACK_1cacheDisplayInRect_1toBitmapImageRep_1_FUNC,
CALLBACK_1canDragRowsWithIndexes_1atPoint_1_FUNC,
CALLBACK_1cellBaselineOffset_FUNC,
CALLBACK_1cellSize_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index 9e6ce3da39..531dcf55cc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -680,6 +680,8 @@ public static final native void objc_msgSend_stret(NSSize result, long /*int*/ i
public static final native long /*int*/ CALLBACK_accessibilityHitTest_(long /*int*/ func);
/** @method callback_types=NSAttributedString*;id;SEL;NSRange;,callback_flags=none;none;none;struct; */
public static final native long /*int*/ CALLBACK_attributedSubstringFromRange_(long /*int*/ func);
+/** @method callback_types=void;id;SEL;NSRect;NSBitmapImageRep*;,callback_flags=none;none;none;struct;none; */
+public static final native long /*int*/ CALLBACK_cacheDisplayInRect_toBitmapImageRep_(long /*int*/ func);
/** @method callback_types=BOOL;id;SEL;NSIndexSet*;NSPoint;,callback_flags=none;none;none;none;struct; */
public static final native long /*int*/ CALLBACK_canDragRowsWithIndexes_atPoint_(long /*int*/ func);
/** @method callback_types=NSSize;id;SEL;,callback_flags=struct;none;none; */

Back to the top