java-gobject-introspection r149 - in trunk/src/org/gnome/gir: gobject runtime



Author: walters
Date: Sun Dec  7 19:01:11 2008
New Revision: 149
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=149&view=rev

Log:
Remove weak ref in finalizer, we no longer care about the object

This avoids noise from later weakrefs, and is cleaner/safer since I
believe it would have been possible to call into the weakref
from inside the toggle unref.  That isn't necessary.

Modified:
   trunk/src/org/gnome/gir/gobject/GObjectAPI.java
   trunk/src/org/gnome/gir/runtime/GObject.java

Modified: trunk/src/org/gnome/gir/gobject/GObjectAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GObjectAPI.java	(original)
+++ trunk/src/org/gnome/gir/gobject/GObjectAPI.java	Sun Dec  7 19:01:11 2008
@@ -90,8 +90,8 @@
     interface GWeakNotify extends Callback {
         void callback(Pointer data, Pointer obj);
     }
-    void g_object_weak_ref(GObject object, GWeakNotify notify, Pointer data);
-    void g_object_weak_unref(GObject object, GWeakNotify notify, Pointer data);
+    void g_object_weak_ref(Pointer object, GWeakNotify notify, Pointer data);
+    void g_object_weak_unref(Pointer object, GWeakNotify notify, Pointer data);
     Pointer g_object_ref(GObject object);
     void g_object_ref_sink(GObject object);
     void g_object_unref(GObject object);

Modified: trunk/src/org/gnome/gir/runtime/GObject.java
==============================================================================
--- trunk/src/org/gnome/gir/runtime/GObject.java	(original)
+++ trunk/src/org/gnome/gir/runtime/GObject.java	Sun Dec  7 19:01:11 2008
@@ -162,7 +162,7 @@
 		 * The weak notify is just a convenient hook into object destruction so
 		 * we can clear out our signal handlers and strong ref; see below.
 		 */
-		GObjectAPI.gobj.g_object_weak_ref(this, weakNotify, null);
+		GObjectAPI.gobj.g_object_weak_ref(init.ptr, weakNotify, null);
 
 		/*
 		 * Normally we have a strong reference given to us by constructors,
@@ -280,8 +280,9 @@
 		if (disposed)
 			return;
 		/* Take away the toggle reference */
-		debugMemoryFinal(this, "REMOVING TOGGLE %s %s%n");
-		GObjectAPI.gobj.g_object_remove_toggle_ref(getNativeAddress(), toggle, objectID);
+		debugMemoryFinal(this, "REMOVING TOGGLE AND WEAK %s %s%n");
+		GObjectAPI.gobj.g_object_weak_unref(getNativeAddress(), weakNotify, null);		
+		GObjectAPI.gobj.g_object_remove_toggle_ref(getNativeAddress(), toggle, objectID);		
 	}
 
 	public synchronized long connect(String signal, Callback closure) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]