[Xfce4-commits] [apps/parole] 01/01: Disconnect window-state-changed event when finalizing plugins (LP: #1698540)

noreply at xfce.org noreply at xfce.org
Thu Apr 4 04:26:53 CEST 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/parole.

commit 95be536f7326bbc9eadc31c3f647ae8ac8ab43be
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Wed Apr 3 22:26:46 2019 -0400

    Disconnect window-state-changed event when finalizing plugins (LP: #1698540)
---
 src/parole-plugin-player.c           | 14 ++++++++++----
 src/plugins/mpris2/mpris2-provider.c | 17 +++++++++++++----
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/parole-plugin-player.c b/src/parole-plugin-player.c
index 953b001..c8bedd3 100644
--- a/src/parole-plugin-player.c
+++ b/src/parole-plugin-player.c
@@ -50,6 +50,7 @@ struct ParolePluginPlayerPrivate {
     GtkWidget *gst;
     GtkWidget *box;
 
+    gulong window_state_changed;
     gulong state_changed;
     gulong tag_message;
     gulong seeked;
@@ -307,10 +308,10 @@ parole_plugin_player_init(ParolePluginPlayer *player) {
 
     player->priv->fullscreen = FALSE;
     window = GTK_WIDGET(gtk_widget_get_toplevel(player->priv->gst));
-    g_signal_connect(G_OBJECT(window),
-                     "window-state-event",
-                     G_CALLBACK(parole_plugin_player_window_state_event),
-                     player);
+    player->priv->window_state_changed = g_signal_connect(G_OBJECT(window),
+                                                          "window-state-event",
+                                                          G_CALLBACK(parole_plugin_player_window_state_event),
+                                                          player);
 
     player->priv->packed = FALSE;
     player->priv->box = NULL;
@@ -319,6 +320,7 @@ parole_plugin_player_init(ParolePluginPlayer *player) {
 static void
 parole_plugin_player_finalize(GObject *object) {
     ParolePluginPlayer *player;
+    GtkWidget          *window;
 
     player = PAROLE_PLUGIN_PLAYER(object);
 
@@ -331,6 +333,10 @@ parole_plugin_player_finalize(GObject *object) {
 
         if (g_signal_handler_is_connected (player->priv->gst, player->priv->seeked))
             g_signal_handler_disconnect(player->priv->gst, player->priv->seeked);
+
+        window = GTK_WIDGET(gtk_widget_get_toplevel(player->priv->gst));
+        if (g_signal_handler_is_connected (window, player->priv->window_state_changed))
+            g_signal_handler_disconnect(window, player->priv->window_state_changed);
     }
 
     if ( player->priv->packed && GTK_IS_WIDGET (player->priv->box))
diff --git a/src/plugins/mpris2/mpris2-provider.c b/src/plugins/mpris2/mpris2-provider.c
index 6b5f5a6..7062512 100644
--- a/src/plugins/mpris2/mpris2-provider.c
+++ b/src/plugins/mpris2/mpris2-provider.c
@@ -58,6 +58,8 @@ struct _Mpris2Provider {
     gchar                  *saved_title;
     gdouble                 volume;
     ParoleState             state;
+
+    gulong                  window_state_changed;
 };
 
 PAROLE_DEFINE_TYPE_WITH_CODE(Mpris2Provider,
@@ -969,10 +971,10 @@ mpris2_provider_set_player(ParoleProviderPlugin *plugin, ParoleProviderPlayer *p
                       G_CALLBACK(conf_changed_cb), plugin);
 
     window = parole_provider_player_get_main_window(provider->player);
-    g_signal_connect(G_OBJECT(window),
-                     "window-state-event",
-                     G_CALLBACK(on_window_state_event),
-                     provider);
+    provider->window_state_changed = g_signal_connect(G_OBJECT(window),
+                                                      "window-state-event",
+                                                      G_CALLBACK(on_window_state_event),
+                                                      provider);
 }
 
 static void
@@ -993,9 +995,16 @@ static void mpris2_provider_init(Mpris2Provider *provider) {
 }
 
 static void mpris2_provider_finalize(GObject *object) {
+    GtkWidget      *window;
     Mpris2Provider *provider;
     provider = MPRIS2_PROVIDER(object);
 
+    if (provider->window_state_changed > 0) {
+        window = parole_provider_player_get_main_window(provider->player);
+        if (g_signal_handler_is_connected(window, provider->window_state_changed))
+            g_signal_handler_disconnect(window, provider->window_state_changed);
+    }
+
     if (NULL != provider->dbus_connection) {
         g_dbus_connection_unregister_object(provider->dbus_connection,
                                              provider->registration_id0);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list