[libshumate] ShumateMarkerLayer, ShumatePathLayer: disconnect from viewport



commit a6b1e3c7d0a28dda5fb57d4eec8e2dfdfb5b309c
Author: Andy Holmes <andrew g r holmes gmail com>
Date:   Sat Oct 2 23:32:57 2021 -0700

    ShumateMarkerLayer, ShumatePathLayer: disconnect from viewport
    
    Signal connections to the ShumateViewport were not being disconnected
    in dispose, leading to segfaults if the viewport outlived the layer.

 shumate/shumate-marker-layer.c | 4 ++++
 shumate/shumate-path-layer.c   | 3 +++
 2 files changed, 7 insertions(+)
---
diff --git a/shumate/shumate-marker-layer.c b/shumate/shumate-marker-layer.c
index f8bfab9..8e4a0d0 100644
--- a/shumate/shumate-marker-layer.c
+++ b/shumate/shumate-marker-layer.c
@@ -290,8 +290,12 @@ shumate_marker_layer_set_property (GObject *object,
 static void
 shumate_marker_layer_dispose (GObject *object)
 {
+  ShumateMarkerLayer *self = SHUMATE_MARKER_LAYER (object);
+  ShumateViewport *viewport = shumate_layer_get_viewport (SHUMATE_LAYER (self));
   GtkWidget *child;
 
+  g_signal_handlers_disconnect_by_data (viewport, self);
+
   while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
     gtk_widget_unparent (child);
 
diff --git a/shumate/shumate-path-layer.c b/shumate/shumate-path-layer.c
index 73b0bce..c24a6b2 100644
--- a/shumate/shumate-path-layer.c
+++ b/shumate/shumate-path-layer.c
@@ -224,6 +224,9 @@ shumate_path_layer_dispose (GObject *object)
 {
   ShumatePathLayer *self = SHUMATE_PATH_LAYER (object);
   ShumatePathLayerPrivate *priv = shumate_path_layer_get_instance_private (self);
+  ShumateViewport *viewport = shumate_layer_get_viewport (SHUMATE_LAYER (self));
+
+  g_signal_handlers_disconnect_by_data (viewport, self);
 
   if (priv->nodes)
     shumate_path_layer_remove_all (SHUMATE_PATH_LAYER (object));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]