aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-05 00:56:37 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-05 00:57:40 +0800
commit369831e140c00a2578fb99c1e09fe369e80f0261 (patch)
tree425e91778e4d5fed97a9647f9f5f297c730c0250 /shell
parent9b18df6a81ed7f01672b1fa53cbeb1de3dc4dde2 (diff)
downloadgsoc2013-evolution-369831e140c00a2578fb99c1e09fe369e80f0261.tar.gz
gsoc2013-evolution-369831e140c00a2578fb99c1e09fe369e80f0261.tar.zst
gsoc2013-evolution-369831e140c00a2578fb99c1e09fe369e80f0261.zip
Fix crash when second main window is closed.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-content.c72
-rw-r--r--shell/e-shell-view.c12
2 files changed, 41 insertions, 43 deletions
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 610a5b0d4e..9e28bc8075 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -50,10 +50,9 @@ struct _EShellContentPrivate {
gchar *system_filename;
gchar *user_filename;
- /* Container for the following widgets */
GtkWidget *search_bar;
- /* Search bar widgets */
+ /* Search bar children (not referenced) */
GtkWidget *filter_label;
GtkWidget *filter_combo_box;
GtkWidget *search_label;
@@ -508,46 +507,11 @@ shell_content_dispose (GObject *object)
priv->shell_view = NULL;
}
- if (priv->search_bar != NULL) {
- g_object_unref (priv->search_bar);
- priv->search_bar = NULL;
- }
-
- if (priv->filter_label != NULL) {
- g_object_unref (priv->filter_label);
- priv->filter_label = NULL;
- }
-
- if (priv->filter_combo_box != NULL) {
- g_object_unref (priv->filter_combo_box);
- priv->filter_combo_box = NULL;
- }
-
if (priv->search_context != NULL) {
g_object_unref (priv->search_context);
priv->search_context = NULL;
}
- if (priv->search_label != NULL) {
- g_object_unref (priv->search_label);
- priv->search_label = NULL;
- }
-
- if (priv->search_entry != NULL) {
- g_object_unref (priv->search_entry);
- priv->search_entry = NULL;
- }
-
- if (priv->scope_label != NULL) {
- g_object_unref (priv->scope_label);
- priv->scope_label = NULL;
- }
-
- if (priv->scope_combo_box != NULL) {
- g_object_unref (priv->scope_combo_box);
- priv->scope_combo_box = NULL;
- }
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -617,6 +581,24 @@ shell_content_constructed (GObject *object)
}
static void
+shell_content_destroy (GtkObject *gtk_object)
+{
+ EShellContentPrivate *priv;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (gtk_object);
+
+ if (priv->search_bar != NULL) {
+ gtk_widget_unparent (priv->search_bar);
+ gtk_widget_destroy (priv->search_bar);
+ g_object_unref (priv->search_bar);
+ priv->search_bar = NULL;
+ }
+
+ /* Chain up to parent's destroy() method. */
+ GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);
+}
+
+static void
shell_content_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
@@ -692,6 +674,7 @@ static void
shell_content_class_init (EShellContentClass *class)
{
GObjectClass *object_class;
+ GtkObjectClass *gtk_object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
@@ -705,6 +688,9 @@ shell_content_class_init (EShellContentClass *class)
object_class->finalize = shell_content_finalize;
object_class->constructed = shell_content_constructed;
+ gtk_object_class = GTK_OBJECT_CLASS (class);
+ gtk_object_class->destroy = shell_content_destroy;
+
widget_class = GTK_WIDGET_CLASS (class);
widget_class->size_request = shell_content_size_request;
widget_class->size_allocate = shell_content_size_allocate;
@@ -877,7 +863,7 @@ shell_content_init (EShellContent *shell_content)
* "Important Messages", or "Active Appointments". */
widget = gtk_label_new_with_mnemonic (_("Sho_w:"));
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
- shell_content->priv->filter_label = g_object_ref (widget);
+ shell_content->priv->filter_label = widget;
gtk_widget_show (widget);
label = GTK_LABEL (widget);
@@ -885,7 +871,7 @@ shell_content_init (EShellContent *shell_content)
widget = e_action_combo_box_new ();
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
- shell_content->priv->filter_combo_box = g_object_ref (widget);
+ shell_content->priv->filter_combo_box = widget;
gtk_widget_show (widget);
/* Search Entry Widgets */
@@ -902,7 +888,7 @@ shell_content_init (EShellContent *shell_content)
* example: Search: [_______________] in [ Current Folder ] */
widget = gtk_label_new_with_mnemonic (_("Sear_ch:"));
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
- shell_content->priv->search_label = g_object_ref (widget);
+ shell_content->priv->search_label = widget;
gtk_widget_show (widget);
label = GTK_LABEL (widget);
@@ -910,7 +896,7 @@ shell_content_init (EShellContent *shell_content)
widget = e_hinted_entry_new ();
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
- shell_content->priv->search_entry = g_object_ref (widget);
+ shell_content->priv->search_entry = widget;
gtk_widget_show (widget);
g_signal_connect_swapped (
@@ -944,7 +930,7 @@ shell_content_init (EShellContent *shell_content)
* example: Search: [_______________] in [ Current Folder ] */
widget = gtk_label_new_with_mnemonic (_("i_n"));
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
- shell_content->priv->scope_label = g_object_ref (widget);
+ shell_content->priv->scope_label = widget;
gtk_widget_show (widget);
label = GTK_LABEL (widget);
@@ -952,7 +938,7 @@ shell_content_init (EShellContent *shell_content)
widget = e_action_combo_box_new ();
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
- shell_content->priv->scope_combo_box = g_object_ref (widget);
+ shell_content->priv->scope_combo_box = widget;
gtk_widget_show (widget);
}
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index ccd5de6f31..2d50300183 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -353,6 +353,18 @@ shell_view_dispose (GObject *object)
}
if (priv->size_group != NULL) {
+ GSList *list;
+
+ /* Remove all widgets from the size group. */
+ list = gtk_size_group_get_widgets (priv->size_group);
+ list = g_slist_copy (list);
+
+ while (list != NULL) {
+ gtk_size_group_remove_widget (
+ priv->size_group, list->data);
+ list = g_slist_delete_link (list, list);
+ }
+
g_object_unref (priv->size_group);
priv->size_group = NULL;
}