Anjuta document manager using not existing bags.



"Glimmer Nautilus View" does not have a property bag. This results
in Bonobo_PropertyBag_getValue returning IDL:omg.org/CORBA/INV_OBJREF:1.0
as exception. This is not "IDL:Bonobo/PropertyBag/NotFound:1.0", and so
it is assumed that there is a "modified" flag. This results in a
(potential) crash when unloading the component.

To reproduce the bug, start anjuta2 ands switch several times between
"Glimmer Editor" and "Glimmer Nautilus View".

Index: plugins/document-manager/anjuta-document.c
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/document-manager/anjuta-document.c,v
retrieving revision 1.50
diff -u -r1.50 anjuta-document.c
--- plugins/document-manager/anjuta-document.c	23 Jun 2002 15:39:03 -0000	1.50
+++ plugins/document-manager/anjuta-document.c	8 Dec 2002 11:40:55 -0000
@@ -576,33 +576,38 @@
 			(document->control_frame, &ev);
 		g_assert (!BONOBO_EX (&ev));
 
-		any = Bonobo_PropertyBag_getValue (bag, "dirty", &ev);
-		if (BONOBO_USER_EX (&ev, "IDL:Bonobo/PropertyBag/NotFound:1.0")) {
-			document->priv->supports_modified = FALSE;
-		} else {
-			Bonobo_EventSource source;
-			BonoboListener *listener;
+		if(bag != CORBA_OBJECT_NIL)
+		{
+			any = Bonobo_PropertyBag_getValue (bag, "dirty", &ev);
+			if (BONOBO_USER_EX (&ev, "IDL:Bonobo/PropertyBag/NotFound:1.0")) {
+				document->priv->supports_modified = FALSE;
+			} else {
+				Bonobo_EventSource source;
+				BonoboListener *listener;
 
-			CORBA_free (any);
+				CORBA_free (any);
 
-			source = Bonobo_Unknown_queryInterface (bag,
-								"IDL:Bonobo/EventSource:1.0",
-								&ev);
+				source = Bonobo_Unknown_queryInterface (bag,
+									"IDL:Bonobo/EventSource:1.0",
+									&ev);
 
-			listener = bonobo_listener_new (anjuta_bonobo_document_dirty, document);
-			g_object_set_data (G_OBJECT (document), "DirtyListener", listener);
+				listener = bonobo_listener_new (anjuta_bonobo_document_dirty, document);
+				g_object_set_data (G_OBJECT (document), "DirtyListener", listener);
 
-			/* Register listener for "dirty" event. */
-			if (!CORBA_Object_is_nil (source, &ev) && ev._major == CORBA_NO_EXCEPTION) {
-				Bonobo_EventSource_addListenerWithMask (source,
-									BONOBO_OBJREF (listener),
-									"Bonobo/Property:change:dirty",
-									&ev);
-				g_assert (!BONOBO_EX (&ev));
-			}
+				/* Register listener for "dirty" event. */
+				if (!CORBA_Object_is_nil (source, &ev) && ev._major == CORBA_NO_EXCEPTION) {
+					Bonobo_EventSource_addListenerWithMask (source,
+										BONOBO_OBJREF (listener),
+										"Bonobo/Property:change:dirty",
+										&ev);
+					g_assert (!BONOBO_EX (&ev));
+				}
 
-			document->priv->supports_modified = TRUE;
+				document->priv->supports_modified = TRUE;
+			}
 		}
+		else /* bag == CORBA_OBJECT_NIL */
+			document->priv->supports_modified = FALSE;
 
 		document->priv->current_component = component;
 	}



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