summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-03-07 12:13:59 +0100
committerCarlos Soriano <csoriano@gnome.org>2016-03-07 12:37:15 +0100
commit42d2bc92a56728fe620a5ce51fd21bd83039b475 (patch)
tree19e9ad128b5b29bfbad9745a627750df9103a37b
parent26192677c9ecf10573cf0df511fd093cfc6e6952 (diff)
downloadnautilus-42d2bc92a56728fe620a5ce51fd21bd83039b475.tar.gz
content-bar: don't auto destroy the widget
We were auto destroying the content bar if the mime type couldn't be handled. This is wrong since the caller is not aware of anything, trying to show or do other things with the destroyed widget. I'm not sure how this even work, if it worked at all. Previously it wasn't crashing because gtk+ was failing gratefully, however, with the gadget rework, this makes gtk+ crash. We fixed this in the previous patch, only creating the content bar if we can handle the myme types. This patch adds a few more guards and, in any case, avoid to destroy the widget inside the widget itself. https://bugzilla.gnome.org/show_bug.cgi?id=762703
-rw-r--r--src/nautilus-x-content-bar.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c
index e4a6c1eaf..5f9ef40ff 100644
--- a/src/nautilus-x-content-bar.c
+++ b/src/nautilus-x-content-bar.c
@@ -91,6 +91,11 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar, const char
g_strfreev (bar->priv->x_content_types);
+ if (!should_handle_content_types (x_content_types)) {
+ g_warning ("Content types in content types bar cannot be handled. Check before creating the content bar if they can be handled.");
+ return;
+ }
+
types = g_ptr_array_new ();
apps = g_ptr_array_new ();
g_ptr_array_set_free_func (apps, g_object_unref);
@@ -109,9 +114,6 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar, const char
bar->priv->x_content_types = (char **) g_ptr_array_free (types, FALSE);
switch (num_types) {
- case 0:
- message = NULL;
- break;
case 1:
message = get_message_for_content_type (bar->priv->x_content_types[0]);
break;
@@ -123,12 +125,6 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar, const char
break;
}
- if (message == NULL) {
- g_ptr_array_free (apps, TRUE);
- gtk_widget_destroy (GTK_WIDGET (bar));
- return;
- }
-
gtk_label_set_text (GTK_LABEL (bar->priv->label), message);
g_free (message);