[evolution-patches] Fix for evolution/shell/Evolution-Component.idl



The mail/Evolution-Mail.idl file includes
shell/Evolution-Component.idl. This means that, unless precautions are
taken, the IDL compiler will generate duplicate function inthe skels
(and maybe stubs, but I only noticed this in the skels) when massaging
shell/Evolution.idl and mail/Evolution-Mail.idl. In both
shell/Evolution-skels.c and mail/Evolution-Mail-skels.c you have for
instance a function POA_GNOME_Evolution_Component__init(). Clearly,
this makes little sense.

Things happen to work out correctly on Linux, apparently more or less
by chance, because of the order in which the shared libraries
libeshell.so and libevolution-mail.so are loaded, and the detail of
how ELF dynamic loading works. On Win32 things happen to work out
differently, leading to a hard-to-diagnose bug over which I and
Michael Meeks spent some hours debugging and IRCing today.

The fix is to surround Evolution-Component.idl with guards that
prevent the IDL compiler from generating code when that IDL file is
just included in some other IDL file. This is the same technique that
Bonobo.idl uses, for instance.

Below is the patch to shell/Evolution-Component.idl and
shell/Makefile.am. (Here I edited out irrelevant parts from the
Makefile.am diff.)

Quite probably the same thing should be done in all IDL files that get
includes by other IDL files, for instance
Evolution-DataServer-Calendar.idl in e-d-s.

Thanks to Michael Meeks for the explanation and advice.

--tml

Index: shell/Evolution-Component.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution-Component.idl,v
retrieving revision 1.16
diff -p -u -2 -r1.16 Evolution-Component.idl
--- shell/Evolution-Component.idl	2 Jun 2005 05:51:53 -0000	1.16
+++ shell/Evolution-Component.idl	7 Jun 2005 15:15:03 -0000
@@ -14,4 +14,13 @@
 #include <Bonobo.idl>
 
+#ifndef __Evolution_Component_COMPILATION
+#ifdef __ORBIT_IDL__
+%{
+#pragma include_defs shell/evolution-component.h
+%}
+#pragma inhibit push
+#endif
+#endif
+
 module GNOME {
 module Evolution {
@@ -103,3 +112,8 @@ module Evolution {
 };
 
+#ifndef __Evolution_Component_COMPILATION
+#ifdef __ORBIT_IDL__
+#pragma inhibit pop
+#endif
 #endif
+#endif	/* _GNOME_EVOLUTION_COMPONENT_IDL */
Index: shell/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/shell/Makefile.am,v
retrieving revision 1.207
diff -p -u -2 -r1.207 Makefile.am
--- shell/Makefile.am	2 Jun 2005 04:28:11 -0000	1.207
+++ shell/Makefile.am	7 Jun 2005 15:15:03 -0000
@@ -40,8 +39,11 @@ IDL_GENERATED_C = 		\
 	Evolution-stubs.c
 
+idl_defines = \
+	-D__Evolution_Component_COMPILATION
+
 IDL_GENERATED = $(IDL_GENERATED_H) $(IDL_GENERATED_C)
 
 $(IDL_GENERATED_H): $(IDLS)
-	$(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(srcdir)/Evolution.idl
+	$(ORBIT_IDL) -I $(srcdir) $(idl_defines) $(IDL_INCLUDES) $(srcdir)/Evolution.idl
 
 $(IDL_GENERATED_C): $(IDL_GENERATED_H)




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