[gnome-remote-desktop] session: Disconnect num/caps lock changed signals when stopping
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] session: Disconnect num/caps lock changed signals when stopping
- Date: Tue, 7 Dec 2021 21:21:49 +0000 (UTC)
commit b50308b80faf7b535df0fc48dac26cbdf43aa6b7
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Nov 26 10:21:51 2021 +0100
session: Disconnect num/caps lock changed signals when stopping
Otherwise we might receive notifications after stopping or even
finalizing, causing crashes.
src/grd-session.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/grd-session.c b/src/grd-session.c
index e5463273..32fdc671 100644
--- a/src/grd-session.c
+++ b/src/grd-session.c
@@ -73,6 +73,9 @@ typedef struct _GrdSessionPrivate
GCancellable *cancellable;
gboolean started;
+
+ gulong caps_lock_state_changed_id;
+ gulong num_lock_state_changed_id;
} GrdSessionPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GrdSession, grd_session, G_TYPE_OBJECT);
@@ -104,6 +107,11 @@ grd_session_stop (GrdSession *session)
}
}
+ g_clear_signal_handler (&priv->caps_lock_state_changed_id,
+ priv->remote_desktop_session);
+ g_clear_signal_handler (&priv->num_lock_state_changed_id,
+ priv->remote_desktop_session);
+
g_clear_object (&priv->remote_desktop_session);
g_clear_object (&priv->screen_cast_session);
@@ -776,12 +784,14 @@ on_remote_desktop_session_proxy_acquired (GObject *object,
on_screen_cast_session_created,
session);
- g_signal_connect (session_proxy, "notify::caps-lock-state",
- G_CALLBACK (on_caps_lock_state_changed),
- session);
- g_signal_connect (session_proxy, "notify::num-lock-state",
- G_CALLBACK (on_num_lock_state_changed),
- session);
+ priv->caps_lock_state_changed_id =
+ g_signal_connect (session_proxy, "notify::caps-lock-state",
+ G_CALLBACK (on_caps_lock_state_changed),
+ session);
+ priv->num_lock_state_changed_id =
+ g_signal_connect (session_proxy, "notify::num-lock-state",
+ G_CALLBACK (on_num_lock_state_changed),
+ session);
if (klass->remote_desktop_session_ready)
klass->remote_desktop_session_ready (session);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]