java-gobject-introspection r150 - trunk/src/org/gnome/gir/runtime



Author: walters
Date: Sun Dec  7 19:01:14 2008
New Revision: 150
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=150&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/runtime/GObject.java

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:14 2008
@@ -279,9 +279,17 @@
 		/* If the native object already went away, we have nothing to do here. */
 		if (disposed)
 			return;
-		/* Take away the toggle reference */
 		debugMemoryFinal(this, "REMOVING TOGGLE AND WEAK %s %s%n");
-		GObjectAPI.gobj.g_object_weak_unref(getNativeAddress(), weakNotify, null);		
+		/*
+		 * Remove the weak ref notifier. We no longer care about this native
+		 * object (for now). If we see a pointer from it again, we'll create a
+		 * new proxy at that time.
+		 */
+		GObjectAPI.gobj.g_object_weak_unref(getNativeAddress(), weakNotify, null);
+		/*
+		 * Take away the toggle reference; this may or may not cause destruction
+		 * of the native object.
+		 */		
 		GObjectAPI.gobj.g_object_remove_toggle_ref(getNativeAddress(), toggle, objectID);		
 	}
 



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