Bug 407077 - (SWT:2591): GLib-GObject-WARNING **: gclosure.c:697: unable to remove uninstalled invalidation notifier
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 e7bb60d..2231032 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 @@
}
#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 b6f21a5..576b8eb 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 @@
"_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 c503d9c..b42f0f7 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 @@
_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 59c2960..aad5a38 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 @@
}
}
/** @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 99ce322..9bc01db 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 @@
}
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 @@
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$