[rhythmbox] grilo: Fix crash due to lingering signal handler
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] grilo: Fix crash due to lingering signal handler
- Date: Fri, 26 Aug 2016 12:19:33 +0000 (UTC)
commit d0e28c07b16969e611243edec9a26e151dfcca2f
Author: Victor Toso <me victortoso com>
Date: Thu Aug 25 15:21:49 2016 +0200
grilo: Fix crash due to lingering signal handler
If the grilo rhythmbox plugin is deactivated and reactivated, the
signal handler for "source-added" and "source-removed" will remain
alive causing a crash as the previous RBGriloPlugin instance does not
exist anymore.
Backtrace:
#0 0x00007f0f9af231c8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007f0f9af2464a in __GI_abort () at abort.c:89
#2 0x00007f0f9b7386a5 in g_assertion_message (domain=domain@entry=0x7f0f9b759fae "GLib",
file=file@entry=0x7f0f9b75ec90 "/build/glib2.0-fJSoGg/glib2.0-2.48.1/./glib/ghash.c", line=line@entry=373,
func=func@entry=0x7f0f9b75eed0 <__func__.10230> "g_hash_table_lookup_node",
message=message@entry=0x3113c30 "assertion failed: (hash_table->ref_count > 0)")
at ././glib/gtestutils.c:2429
#3 0x00007f0f9b73873a in g_assertion_message_expr (domain=domain@entry=0x7f0f9b759fae "GLib",
file=file@entry=0x7f0f9b75ec90 "/build/glib2.0-fJSoGg/glib2.0-2.48.1/./glib/ghash.c",
line=line@entry=373, func=func@entry=0x7f0f9b75eed0 <__func__.10230> "g_hash_table_lookup_node",
expr=expr@entry=0x7f0f9b75ebd8 "hash_table->ref_count > 0") at ././glib/gtestutils.c:2452
#4 0x00007f0f9b701c4e in g_hash_table_lookup (hash_return=<synthetic pointer>, key=0x19ec730,
hash_table=0x7f0f9ea9ca70) at ././glib/ghash.c:373
#5 0x00007f0f9b701c4e in g_hash_table_lookup (hash_table=0x7f0f9ea9ca70, key=key@entry=0x19ec730) at
././glib/ghash.c:1147
#6 0x00007f0f74024c93 in grilo_source_removed_cb (registry=<optimized out>, grilo_source=0x19ec730
[GrlBookmarksSource], plugin=0x277d370) at rb-grilo-plugin.c:161
Reported-by: vrishab <vrishab in gmail com>
https://bugzilla.gnome.org/show_bug.cgi?id=770044
plugins/grilo/rb-grilo-plugin.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/grilo/rb-grilo-plugin.c b/plugins/grilo/rb-grilo-plugin.c
index 5c56b93..5b9287d 100644
--- a/plugins/grilo/rb-grilo-plugin.c
+++ b/plugins/grilo/rb-grilo-plugin.c
@@ -69,6 +69,8 @@ typedef struct
RBShellPlayer *shell_player;
gulong emit_cover_art_id;
RBExtDB *art_store;
+ gulong handler_id_source_added;
+ gulong handler_id_source_removed;
} RBGriloPlugin;
typedef struct
@@ -211,8 +213,10 @@ impl_activate (PeasActivatable *plugin)
grl_init (0, NULL);
pi->registry = grl_registry_get_default ();
- g_signal_connect (pi->registry, "source-added", G_CALLBACK (grilo_source_added_cb), pi);
- g_signal_connect (pi->registry, "source-removed", G_CALLBACK (grilo_source_removed_cb), pi);
+ pi->handler_id_source_added =
+ g_signal_connect (pi->registry, "source-added", G_CALLBACK (grilo_source_added_cb), pi);
+ pi->handler_id_source_removed =
+ g_signal_connect (pi->registry, "source-removed", G_CALLBACK (grilo_source_removed_cb), pi);
if (grl_registry_load_all_plugins (pi->registry, TRUE, &error) == FALSE) {
g_warning ("Failed to load Grilo plugins: %s", error->message);
g_clear_error (&error);
@@ -248,6 +252,8 @@ impl_deactivate (PeasActivatable *bplugin)
g_hash_table_destroy (plugin->sources);
plugin->sources = NULL;
+ g_signal_handler_disconnect (plugin->registry, plugin->handler_id_source_added);
+ g_signal_handler_disconnect (plugin->registry, plugin->handler_id_source_removed);
plugin->registry = NULL;
if (plugin->emit_cover_art_id != 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]