summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-21 10:00:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-21 10:00:47 (GMT)
commita34a6015b31f79a7f3b8abc68e3bf05f4a5b9ad0 (patch)
tree4bfaae5a83dcc22cbd8c8bd4533b9403c7bc7053 /src
parent3c183ee3be9cd5756bbefe688936fbab370e3840 (diff)
Disconnected redraw signal on dispose to avoid an UAF.
Diffstat (limited to 'src')
-rw-r--r--src/gtkext/gtkblockdisplay.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gtkext/gtkblockdisplay.c b/src/gtkext/gtkblockdisplay.c
index 92c445b..c8d12ea 100644
--- a/src/gtkext/gtkblockdisplay.c
+++ b/src/gtkext/gtkblockdisplay.c
@@ -171,6 +171,21 @@ static void gtk_block_display_init(GtkBlockDisplay *display)
static void gtk_block_display_dispose(GtkBlockDisplay *display)
{
+ GBufferView *view; /* Vue sur du texte */
+
+ /**
+ * Même si à priori, la vue est propre au composant, on coupe le signal
+ * afin qu'une émission d'une instance de vue toujours active ne renvoie pas
+ * en paramètre un composant d'affichage libéré.
+ */
+
+ view = GTK_BUFFER_DISPLAY(display)->view;
+
+ if (view != NULL)
+ g_signal_handlers_disconnect_by_func(G_OBJECT(view),
+ G_CALLBACK(gtk_block_display_need_redraw),
+ display);
+
G_OBJECT_CLASS(gtk_block_display_parent_class)->dispose(G_OBJECT(display));
}
@@ -209,7 +224,7 @@ static void gtk_block_display_finalize(GtkBlockDisplay *display)
GtkWidget *gtk_block_display_new(GBufferView *view)
{
- GtkBlockDisplay *result; /* Composant à retourner */
+ GtkBlockDisplay *result; /* Composant à retourner */
result = g_object_new(GTK_TYPE_BLOCK_DISPLAY, NULL);