Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-python/gnome-python/ChangeLog,v
retrieving revision 1.165
diff -u -p -r1.165 ChangeLog
--- ChangeLog	1 Dec 2003 16:33:12 -0000	1.165
+++ ChangeLog	4 Dec 2003 21:55:47 -0000
@@ -1,3 +1,23 @@
+2003-12-04  Gustavo J. A. M. Carneiro  <gustavo@users.sourceforge.net>
+
+	* bonobo/bonoboui.defs, bonobo/bonobo.defs: Add
+	(caller-owns-return #f) to constructors of BonoboObject-derived
+	classes, so that the code generator g_object_ref's
+	newly-constructed objects. Fixes #127909.
+
+	* bonobo/bonobo.override (_wrap_bonobo_moniker_simple_new_closure)
+	(_wrap_bonobo_moniker_simple_new_closure)
+	(_wrap_bonobo_listener_new_closure)
+	(_wrap_bonobo_property_bag_new_closure)
+	(_wrap_bonobo_item_handler_new_closure)
+	(_wrap_bonobo_stream_mem_create): g_object_ref newly-constructed
+	objects, since we don't own the returned initial reference. Fixes
+	#127909.
+
+	* bonobo/bonoboui.override (_wrap_bonobo_ui_component_new):
+	g_object_ref newly-constructed objects, since we don't own the
+	returned initial reference. Fixes #127909.
+
 2003-12-01  Gustavo J. A. M. Carneiro  <gustavo@users.sourceforge.net>
 
 	* examples/gnomeprint/example_10.py (my_print_cb): fixed typo in
Index: bonobo/bonobo.defs
===================================================================
RCS file: /cvs/gnome/gnome-python/gnome-python/bonobo/bonobo.defs,v
retrieving revision 1.9
diff -u -p -r1.9 bonobo.defs
--- bonobo/bonobo.defs	25 Nov 2003 18:34:55 -0000	1.9
+++ bonobo/bonobo.defs	4 Dec 2003 21:55:49 -0000
@@ -7,6 +7,7 @@
 (define-function bonobo_arg_new_from
   (c-name "bonobo_arg_new_from")
   (return-type "BonoboArg*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboArgType" "t")
     '("gconstpointer" "data")
@@ -420,6 +421,7 @@
   (c-name "bonobo_event_source_new")
   (is-constructor-of BonoboEventSource)
   (return-type "BonoboEventSource*")
+  (caller-owns-return #f)
 )
 
 (define-method notify_listeners
@@ -561,6 +563,7 @@
   (c-name "bonobo_generic_factory_new")
   (is-constructor-of BonoboGenericFactory)
   (return-type "BonoboGenericFactory*")
+  (caller-owns-return #f)
   (parameters
     '("const-char*" "act_iid")
     '("BonoboFactoryCallback" "factory_cb")
@@ -572,6 +575,7 @@
   (c-name "bonobo_generic_factory_new_closure")
   (is-constructor-of BonoboGenericFactory)  
   (return-type "BonoboGenericFactory*")
+  (caller-owns-return #f)
   (parameters
     '("const-char*" "act_iid")
     '("GClosure*" "factory_closure")
@@ -625,6 +629,7 @@
   (c-name "bonobo_item_container_new")
   (is-constructor-of BonoboItemContainer)
   (return-type "BonoboItemContainer*")
+  (caller-owns-return #f)
 )
 
 (define-method add
@@ -659,6 +664,7 @@
   (c-name "bonobo_listener_new")
   (is-constructor-of BonoboListener)
   (return-type "BonoboListener*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboListenerCallbackFn" "event_cb")
     '("gpointer" "user_data")
@@ -669,6 +675,7 @@
   (c-name "bonobo_listener_new_closure")
   (is-constructor-of BonoboListener)  
   (return-type "BonoboListener*")
+  (caller-owns-return #f)
   (parameters
     '("GClosure*" "event_closure")
   )
@@ -894,6 +901,7 @@
   (c-name "bonobo_moniker_simple_new")
   (is-constructor-of BonoboMoniker)
   (return-type "BonoboMoniker*")
+  (caller-owns-return #f)
   (parameters
     '("const-char*" "name")
     '("BonoboMonikerSimpleResolveFn" "resolve_fn")
@@ -904,6 +912,7 @@
   (c-name "bonobo_moniker_simple_new_closure")
   (is-constructor-of BonoboMoniker)
   (return-type "BonoboMoniker*")
+  (caller-owns-return #f)
   (parameters
     '("const-char*" "name")
     '("GClosure*" "resolve_closure")
@@ -1296,6 +1305,7 @@
   (c-name "bonobo_persist_file_new")
   (is-constructor-of BonoboPersistFile)
   (return-type "BonoboPersistFile*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboPersistFileIOFn" "load_fn")
     '("BonoboPersistFileIOFn" "save_fn")
@@ -1366,6 +1376,7 @@
   (c-name "bonobo_persist_stream_new")
   (is-constructor-of BonoboPersistStream)  
   (return-type "BonoboPersistStream*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboPersistStreamIOFn" "load_fn")
     '("BonoboPersistStreamIOFn" "save_fn")
@@ -1908,6 +1919,7 @@
   (c-name "bonobo_property_bag_new")
   (is-constructor-of BonoboPropertyBag)
   (return-type "BonoboPropertyBag*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboPropertyGetFn" "get_prop_cb")
     '("BonoboPropertySetFn" "set_prop_cb")
@@ -1919,6 +1931,7 @@
   (c-name "bonobo_property_bag_new_closure")
   (is-constructor-of BonoboPropertyBag)    
   (return-type "BonoboPropertyBag*")
+  (caller-owns-return #f)
   (parameters
     '("GClosure*" "get_prop")
     '("GClosure*" "set_prop")
@@ -1928,6 +1941,7 @@
 (define-function bonobo_property_bag_new_full
   (c-name "bonobo_property_bag_new_full")
   (return-type "BonoboPropertyBag*")
+  (caller-owns-return #f)
   (parameters
     '("GClosure*" "get_prop")
     '("GClosure*" "set_prop")
@@ -2028,6 +2042,7 @@
   (c-name "bonobo_shlib_factory_new")
   (is-constructor-of BonoboShlibFactory)
   (return-type "BonoboShlibFactory*")
+  (caller-owns-return #f)
   (parameters
     '("const-char*" "component_id")
     '("PortableServer_POA" "poa")
@@ -2041,6 +2056,7 @@
   (c-name "bonobo_shlib_factory_new_closure")
   (is-constructor-of BonoboShlibFactory)
   (return-type "BonoboShlibFactory*")
+  (caller-owns-return #f)
   (parameters
     '("const-char*" "component_id")
     '("PortableServer_POA" "poa")
@@ -2345,6 +2361,7 @@
   (c-name "bonobo_item_handler_new")
   (is-constructor-of BonoboItemHandler)  
   (return-type "BonoboItemHandler*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboItemHandlerEnumObjectsFn" "enum_objects")
     '("BonoboItemHandlerGetObjectFn" "get_object")
@@ -2356,6 +2373,7 @@
   (c-name "bonobo_item_handler_new_closure")
   (is-constructor-of BonoboItemHandler)  
   (return-type "BonoboItemHandler*")
+  (caller-owns-return #f)
   (parameters
     '("GClosure*" "enum_objects")
     '("GClosure*" "get_object")
@@ -2393,6 +2411,7 @@
   (c-name "bonobo_foreign_object_new")
   (is-constructor-of BonoboForeignObject)
   (return-type "BonoboObject*")
+  (caller-owns-return #f)
   (parameters
    '("CORBA_Object" "corba_objref")
    )
Index: bonobo/bonobo.override
===================================================================
RCS file: /cvs/gnome/gnome-python/gnome-python/bonobo/bonobo.override,v
retrieving revision 1.18
diff -u -p -r1.18 bonobo.override
--- bonobo/bonobo.override	25 Nov 2003 18:34:55 -0000	1.18
+++ bonobo/bonobo.override	4 Dec 2003 21:55:50 -0000
@@ -62,6 +62,7 @@ _wrap_bonobo_generic_factory_new_closure
 			"could not create BonoboGenericFactory");
 	return -1;
     }
+    g_object_ref (self->obj);
     pygobject_register_wrapper ((PyObject *)self);
     return 0;
 }
@@ -95,6 +96,7 @@ _wrap_bonobo_moniker_simple_new_closure 
 			"could not create BonoboMonikerSimple");
 	return -1;
     }
+    g_object_ref (self->obj);
     pygobject_register_wrapper ((PyObject *)self);
     
     return 0;
@@ -127,6 +129,7 @@ _wrap_bonobo_listener_new_closure (PyGOb
 			"could not create BonoboListener");
 	return -1;
     }
+    g_object_ref (self->obj);
     pygobject_register_wrapper ((PyObject *)self);
     
     return 0; 
@@ -167,6 +170,7 @@ _wrap_bonobo_property_bag_new_closure (P
 			"could not create BonoboPropertyBag");
 	return -1;
     }
+    g_object_ref (self->obj);
     pygobject_register_wrapper ((PyObject *)self);
     
     return 0;
@@ -239,6 +243,7 @@ _wrap_bonobo_item_handler_new_closure (P
 			"could not create BonoboItemHandler");
 	return -1;
     }
+    g_object_ref (self->obj);
     pygobject_register_wrapper ((PyObject *)self);
     
     return 0;
@@ -355,6 +360,7 @@ _wrap_bonobo_stream_mem_create(PyGObject
         PyErr_SetString(PyExc_RuntimeError, "could not create BonoboStreamMem object");
         return -1;
     }
+    g_object_ref (self->obj);
     pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
Index: bonobo/bonoboui.defs
===================================================================
RCS file: /cvs/gnome/gnome-python/gnome-python/bonobo/bonoboui.defs,v
retrieving revision 1.14
diff -u -p -r1.14 bonoboui.defs
--- bonobo/bonoboui.defs	12 Aug 2003 16:17:33 -0000	1.14
+++ bonobo/bonoboui.defs	4 Dec 2003 21:55:53 -0000
@@ -22,6 +22,7 @@
   (c-name "bonobo_canvas_component_new")
   (is-constructor-of BonoboCanvasComponent)
   (return-type "BonoboCanvasComponent*")
+  (caller-owns-return #f)
   (parameters
     '("GnomeCanvasItem*" "item")
   )
@@ -118,6 +119,7 @@
   (c-name "bonobo_control_frame_new")
   (is-constructor-of BonoboControlFrame)  
   (return-type "BonoboControlFrame*")
+  (caller-owns-return #f)
   (parameters
     '("Bonobo_UIContainer" "ui_container")
   )
@@ -256,6 +258,7 @@
   (c-name "bonobo_control_new")
   (is-constructor-of BonoboControl)
   (return-type "BonoboControl*")
+  (caller-owns-return #f)
   (parameters
     '("GtkWidget*" "widget")
   )
@@ -968,6 +971,7 @@
   (c-name "bonobo_property_control_new_full")
   (is-constructor-of BonoboPropertyControl)
   (return-type "BonoboPropertyControl*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboPropertyControlGetControlFn" "get_fn")
     '("int" "num_pages")
@@ -980,6 +984,7 @@
   (c-name "bonobo_property_control_new")
   (is-constructor-of BonoboPropertyControl)  
   (return-type "BonoboPropertyControl*")
+  (caller-owns-return #f)
   (parameters
     '("BonoboPropertyControlGetControlFn" "get_fn")
     '("int" "num_pages")
@@ -1137,6 +1142,7 @@
   (c-name "bonobo_ui_component_new")
   (is-constructor-of BonoboUIComponent)
   (return-type "BonoboUIComponent*")
+  (caller-owns-return #f)
   (parameters
     '("const-char*" "name")
   )
@@ -1146,6 +1152,7 @@
   (c-name "bonobo_ui_component_new_default")
   (is-constructor-of BonoboUIComponent)
   (return-type "BonoboUIComponent*")
+  (caller-owns-return #f)
 )
 
 (define-method set_name
@@ -1447,6 +1454,7 @@
   (c-name "bonobo_ui_container_new")
   (is-constructor-of BonoboUIContainer)
   (return-type "BonoboUIContainer*")
+  (caller-owns-return #f)
 )
 
 
Index: bonobo/bonoboui.override
===================================================================
RCS file: /cvs/gnome/gnome-python/gnome-python/bonobo/bonoboui.override,v
retrieving revision 1.13
diff -u -p -r1.13 bonoboui.override
--- bonobo/bonoboui.override	14 Jul 2003 12:52:57 -0000	1.13
+++ bonobo/bonoboui.override	4 Dec 2003 21:55:53 -0000
@@ -211,6 +211,7 @@ _wrap_bonobo_ui_component_new(PyGObject 
         PyErr_SetString(PyExc_RuntimeError, "could not create BonoboUIComponent object");
         return -1;
     }
+    g_object_ref (self->obj);
     pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
