Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java9
5 files changed, 29 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index e7bb60deb9..2231032baa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -2577,6 +2577,16 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1closure_1ref)
}
#endif
+#ifndef NO__1g_1closure_1sink
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1closure_1sink)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ OS_NATIVE_ENTER(env, that, _1g_1closure_1sink_FUNC);
+ g_closure_sink((GClosure *)arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1closure_1sink_FUNC);
+}
+#endif
+
#ifndef NO__1g_1closure_1unref
JNIEXPORT void JNICALL OS_NATIVE(_1g_1closure_1unref)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index b6f21a5d6c..576b8eba96 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -229,6 +229,7 @@ char * OS_nativeFunctionNames[] = {
"_1g_1app_1info_1supports_1uris",
"_1g_1cclosure_1new",
"_1g_1closure_1ref",
+ "_1g_1closure_1sink",
"_1g_1closure_1unref",
"_1g_1content_1type_1equals",
"_1g_1content_1type_1is_1a",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index c503d9c53d..b42f0f79ec 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -239,6 +239,7 @@ typedef enum {
_1g_1app_1info_1supports_1uris_FUNC,
_1g_1cclosure_1new_FUNC,
_1g_1closure_1ref_FUNC,
+ _1g_1closure_1sink_FUNC,
_1g_1closure_1unref_FUNC,
_1g_1content_1type_1equals_FUNC,
_1g_1content_1type_1is_1a_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 59c2960e06..aad5a380d2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -2211,6 +2211,16 @@ public static final long /*int*/ g_closure_ref(long /*int*/ closure) {
}
}
/** @param closure cast=(GClosure *) */
+public static final native void _g_closure_sink(long /*int*/ closure);
+public static final void g_closure_sink(long /*int*/ closure) {
+ lock.lock();
+ try {
+ _g_closure_sink(closure);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param closure cast=(GClosure *) */
public static final native void _g_closure_unref(long /*int*/ closure);
public static final void g_closure_unref(long /*int*/ closure) {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 99ce322fd5..9bc01db61b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1465,9 +1465,11 @@ int getCaretBlinkTime () {
}
long /*int*/ getClosure (int id) {
- if (OS.GLIB_VERSION >= OS.VERSION(2, 36, 0) && closuresCount [id]++ > 255) {
+ if (OS.GLIB_VERSION >= OS.VERSION(2, 36, 0) && ++closuresCount [id] >= 255) {
if (closures [id] != 0) OS.g_closure_unref (closures [id]);
closures [id] = OS.g_cclosure_new (closuresProc [id], id, 0);
+ OS.g_closure_ref (closures [id]);
+ OS.g_closure_sink (closures [id]);
closuresCount [id] = 0;
}
return closures [id];
@@ -2719,7 +2721,10 @@ void initializeCallbacks () {
if (closuresProc[i] != 0) {
closures [i] = OS.g_cclosure_new(closuresProc [i], i, 0);
}
- if (closures [i] != 0) OS.g_closure_ref (closures [i]);
+ if (closures [i] != 0) {
+ OS.g_closure_ref (closures [i]);
+ OS.g_closure_sink (closures [i]);
+ }
}
timerCallback = new Callback (this, "timerProc", 1); //$NON-NLS-1$

Back to the top