Context menu bugfix causes "API change"



We've noted a bad bug in the context menu API. The argument for the 
context plugins (a list of uris) is supposed to be sent through the Corba 
interface as a CorbaAny. Unfortunately the code in nautilus just cast:ed 
the array pointer to a CorbaAny. This happens to work in-process, but 
completely breaks oop.

The fix is quite simple, and it really must be done before 2.2. 
Unfortunately this means all the users of this features must be fixed too.

This is the change that is needed for nautilus:

Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.560
diff -u -p -r1.560 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	9 Jan 2003 18:44:10 -0000	1.560
+++ src/file-manager/fm-directory-view.c	20 Jan 2003 15:10:28 -0000
@@ -3560,6 +3560,7 @@ bonobo_mime_action_activate_callback (CO
 	Bonobo_Listener listener;
 	CORBA_Environment ev;
 	BonoboMimeActionData *data;
+	CORBA_any any;
 
 	data = user_data;
 
@@ -3583,8 +3584,9 @@ bonobo_mime_action_activate_callback (CO
 						  &ev);
 
 	if (!BONOBO_EX (&ev)) {
-		Bonobo_Listener_event (listener, data->verb,
-				       (CORBA_any *)data->uri_list, &ev);
+		any._type = TC_CORBA_sequence_CORBA_string;
+		any._value = data->uri_list;
+		Bonobo_Listener_event (listener, data->verb, &any, &ev);
 		bonobo_object_release_unref (listener, &ev);
 	} else {
 		GtkWidget *dialog;


This is the required change in file-roller, given as an example and the 
most important app that need fixing:

Index: component/file-roller-component.c
===================================================================
RCS file: /cvs/gnome/file-roller/component/file-roller-component.c,v
retrieving revision 1.3
diff -u -p -r1.3 file-roller-component.c
--- component/file-roller-component.c	24 Dec 2002 14:10:24 -0000	1.3
+++ component/file-roller-component.c	20 Jan 2003 15:25:08 -0000
@@ -70,7 +70,12 @@ impl_Bonobo_Listener_event (PortableServ
 	int      i;
 
 	frc = FILE_ROLLER_COMPONENT (bonobo_object_from_servant (servant));
-	list = (CORBA_sequence_CORBA_string *)args;
+
+	if (!CORBA_TypeCode_equivalent (args->_type, TC_CORBA_sequence_CORBA_string, ev)) {
+		return;
+	}
+	
+	list = (CORBA_sequence_CORBA_string *)args->_value;
 
 	g_return_if_fail (frc != NULL);
 	g_return_if_fail (list != NULL);


Can I check in the nautilus change?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an uncontrollable bohemian inventor who knows the secret of the alien 
invasion. She's an enchanted streetsmart safe cracker with a birthmark shaped 
like Liberty's torch. They fight crime! 




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