Blame SOURCES/0023-vdagent-Remove-watch-event-on-vdagent_display_destro.patch

ac3420
From bcbbea34d93d07d33b767f808ff3adf628b1ea0f Mon Sep 17 00:00:00 2001
ac3420
From: Victor Toso <victortoso@redhat.com>
ac3420
Date: Fri, 13 Jan 2023 13:54:06 +0100
ac3420
Subject: [PATCH] vdagent: Remove watch event on vdagent_display_destroy()
ac3420
ac3420
To avoid main loop calling it when GIOChannel for x11 was already
ac3420
destroyed.
ac3420
ac3420
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2145004
ac3420
Signed-off-by: Victor Toso <victortoso@redhat.com>
ac3420
---
ac3420
 src/vdagent/display.c | 6 ++++--
ac3420
 1 file changed, 4 insertions(+), 2 deletions(-)
ac3420
ac3420
diff --git a/src/vdagent/display.c b/src/vdagent/display.c
ac3420
index 790d9ad..602ab65 100644
ac3420
--- a/src/vdagent/display.c
ac3420
+++ b/src/vdagent/display.c
ac3420
@@ -60,6 +60,7 @@ struct VDAgentDisplay {
ac3420
     UdscsConnection *vdagentd;
ac3420
     int debug;
ac3420
     GIOChannel *x11_channel;
ac3420
+    guint io_watch_source_id;
ac3420
     VDAgentMutterDBus *mutter;
ac3420
 };
ac3420
 
ac3420
@@ -296,7 +297,8 @@ VDAgentDisplay* vdagent_display_create(UdscsConnection *vdagentd, int debug, int
ac3420
         return NULL;
ac3420
     }
ac3420
 
ac3420
-    g_io_add_watch(display->x11_channel, G_IO_IN, x11_io_channel_cb, display);
ac3420
+    display->io_watch_source_id =
ac3420
+        g_io_add_watch(display->x11_channel, G_IO_IN, x11_io_channel_cb, display);
ac3420
 
ac3420
 
ac3420
     /* Since we are started at the same time as the wm,
ac3420
@@ -323,7 +325,7 @@ void vdagent_display_destroy(VDAgentDisplay *display, int vdagentd_disconnected)
ac3420
         return;
ac3420
     }
ac3420
 
ac3420
-
ac3420
+    g_source_remove(display->io_watch_source_id);
ac3420
     g_clear_pointer(&display->x11_channel, g_io_channel_unref);
ac3420
     vdagent_x11_destroy(display->x11, vdagentd_disconnected);
ac3420
 
ac3420
-- 
ac3420
2.39.0
ac3420