]> git.draconx.ca Git - gob-dx.git/blobdiff - doc/gob.1.in
Release 1.0.3
[gob-dx.git] / doc / gob.1.in
index 01d66cdbf1cb1adb5d3d08cfdb7102cb85321edd..7d0c285f5053538208a5c90ccc699af8e811083d 100644 (file)
@@ -739,13 +739,17 @@ will fetch a new object, so a fairly standard new method would look like:
 
   public GtkObject *
   new(void) {
-         GtkObject *ret;
-         ret = GTK_OBJECT (GET_NEW);
-         return ret;
+         GtkObject *ret = GET_NEW;
+         return GTK_OBJECT (ret);
   }
 
 .fi
 .PP
+You should not a subtle peculiarity of the GTK+ object system here.  If there is any
+code inside the GTK_OBJECT macro argument, it will get executed multiple times.  This
+means that things such as GTK_OBJECT(GET_NEW) would actually create 4 objects, leaking
+3 of them.  A good rule is to be careful with all macros.
+.PP
 Self alias casts:
 .PP
 There are some standard casts defined for you.  Instead of using the full