java-gobject-introspection r22 - trunk/src/org/gnome/gir/gobject



Author: walters
Date: Thu Sep  4 18:37:05 2008
New Revision: 22
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=22&view=rev

Log:
Use static final notify handler instead of new instance per object


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

Modified: trunk/src/org/gnome/gir/gobject/GObject.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GObject.java	(original)
+++ trunk/src/org/gnome/gir/gobject/GObject.java	Thu Sep  4 18:37:05 2008
@@ -75,8 +75,6 @@
      */
     private Map<Long,Callback> signalHandlers = new HashMap<Long, Callback>();
     
-    private GWeakNotify weakNotify = null;
-    
     /**
      * A tagging interface used in the code generator - if a method returns an interface,
      * we have it extend this interface so we know it's a GObject. 
@@ -101,14 +99,6 @@
                 unref();
             }
             
-            /* See the comment for signalHandlers */
-            weakNotify = new GWeakNotify() {
-				@Override
-				public void callback(Pointer data, Pointer obj) {
-					// Clear out the signal handler references
-					signalHandlers = null;
-				}
-            };
             GObjectAPI.gobj.g_object_weak_ref(this, weakNotify, null);
         }
     }
@@ -463,4 +453,13 @@
             }
         }
     };
+    
+    private static final GWeakNotify weakNotify = new GWeakNotify() {
+		@Override
+		public void callback(Pointer data, Pointer obj) {
+			GObject o = (GObject) NativeObject.instanceFor(obj);
+			// Clear out the signal handler references
+			o.signalHandlers = null;
+		}
+    };    
 }



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