aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-09-06 22:36:08 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-09-06 22:36:08 +0800
commit7d777d329b79bc9095c460b1c91d34ff7abefe48 (patch)
tree9cdeaa68303edeef5bd77684d68c6b9066b9eec3
parent51857b1153f08c6fb2dd3fbd4d36e63aeac385bb (diff)
downloadgsoc2013-evolution-7d777d329b79bc9095c460b1c91d34ff7abefe48.tar
gsoc2013-evolution-7d777d329b79bc9095c460b1c91d34ff7abefe48.tar.gz
gsoc2013-evolution-7d777d329b79bc9095c460b1c91d34ff7abefe48.tar.bz2
gsoc2013-evolution-7d777d329b79bc9095c460b1c91d34ff7abefe48.tar.lz
gsoc2013-evolution-7d777d329b79bc9095c460b1c91d34ff7abefe48.tar.xz
gsoc2013-evolution-7d777d329b79bc9095c460b1c91d34ff7abefe48.tar.zst
gsoc2013-evolution-7d777d329b79bc9095c460b1c91d34ff7abefe48.zip
Fix memory handling for the shell's CORBA object reference within the
folder browser. svn path=/trunk/; revision=5221
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/folder-browser-factory.c3
-rw-r--r--mail/folder-browser-factory.h3
-rw-r--r--mail/folder-browser.c36
-rw-r--r--mail/folder-browser.h16
5 files changed, 51 insertions, 17 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9098746446..18834ef228 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2000-09-06 Ettore Perazzoli <ettore@helixcode.com>
+
+ * folder-browser.c (folder_browser_new): @shell made const.
+ `CORBA_Object_duplicate()' it before storing it.
+ (folder_browser_destroy): Free the shell object with
+ `CORBA_Object_release()', not `CORBA_free()'.
+
+ * folder-browser-factory.c (folder_browser_factory_new_control):
+ @shell made const.
+
2000-09-05 Dan Winship <danw@helixcode.com>
* mail-display.c (make_safe_filename):
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index da5c27746d..a3f6095c03 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -374,7 +374,8 @@ control_destroy_cb (BonoboControl *control,
}
BonoboControl *
-folder_browser_factory_new_control (const char *uri, Evolution_Shell shell)
+folder_browser_factory_new_control (const char *uri,
+ const Evolution_Shell shell)
{
BonoboControl *control;
GtkWidget *folder_browser;
diff --git a/mail/folder-browser-factory.h b/mail/folder-browser-factory.h
index e4e26a83d7..b47913a66a 100644
--- a/mail/folder-browser-factory.h
+++ b/mail/folder-browser-factory.h
@@ -14,7 +14,8 @@
#include <bonobo.h>
#include "Evolution.h"
-BonoboControl *folder_browser_factory_new_control (const char *uri, Evolution_Shell shell);
+BonoboControl *folder_browser_factory_new_control (const char *uri,
+ const Evolution_Shell shell);
GList *folder_browser_factory_get_control_list (void);
#endif /* _FOLDER_BROWSER_FACTORY_H */
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index cbd74e002a..72d75af0d3 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -47,11 +47,15 @@ static void oc_destroy (gpointer obj, gpointer user)
static void
folder_browser_destroy (GtkObject *object)
{
- FolderBrowser *folder_browser = FOLDER_BROWSER (object);
+ FolderBrowser *folder_browser;
+ CORBA_Environment ev;
- /*if (folder_browser->shell)
- * CORBA_free (folder_browser->shell);
- */
+ folder_browser = FOLDER_BROWSER (object);
+
+ CORBA_exception_init (&ev);
+
+ if (folder_browser->shell != CORBA_OBJECT_NIL)
+ CORBA_Object_release (folder_browser->shell, &ev);
if (folder_browser->uri)
g_free (folder_browser->uri);
@@ -75,6 +79,8 @@ folder_browser_destroy (GtkObject *object)
g_slist_free (folder_browser->filter_menu_paths);
}
+ CORBA_exception_free (&ev);
+
folder_browser_parent_class->destroy (object);
}
@@ -458,15 +464,29 @@ my_folder_browser_init (GtkObject *object)
}
GtkWidget *
-folder_browser_new (Evolution_Shell shell)
+folder_browser_new (const Evolution_Shell shell)
{
- static int serial;
- FolderBrowser *folder_browser = gtk_type_new (folder_browser_get_type ());
+ static int serial = 0;
+ CORBA_Environment ev;
+ FolderBrowser *folder_browser;
+
+ CORBA_exception_init (&ev);
+
+ folder_browser = gtk_type_new (folder_browser_get_type ());
my_folder_browser_init (GTK_OBJECT (folder_browser));
folder_browser->uri = NULL;
folder_browser->serial = serial++;
- folder_browser->shell = shell;
+
+ folder_browser->shell = CORBA_Object_duplicate (shell, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ folder_browser->shell = CORBA_OBJECT_NIL;
+ gtk_widget_destroy (GTK_WIDGET (folder_browser));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
return GTK_WIDGET (folder_browser);
}
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index 70667077c9..14c75c3367 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -62,12 +62,14 @@ struct fb_ondemand_closure {
gchar *path;
};
-GtkType folder_browser_get_type (void);
-GtkWidget *folder_browser_new (Evolution_Shell shell);
-gboolean folder_browser_set_uri (FolderBrowser *folder_browser,
- const char *uri);
-void folder_browser_set_message_preview (FolderBrowser *folder_browser,
- gboolean show_message_preview);
-void folder_browser_clear_search (FolderBrowser *fb);
+GtkType folder_browser_get_type (void);
+GtkWidget *folder_browser_new (const Evolution_Shell shell);
+
+gboolean folder_browser_set_uri (FolderBrowser *folder_browser,
+ const char *uri);
+
+void folder_browser_set_message_preview (FolderBrowser *folder_browser,
+ gboolean show_message_preview);
+void folder_browser_clear_search (FolderBrowser *fb);
#endif /* _FOLDER_BROWSER_H_ */