Commit c012f31c authored by Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto Committed by Corentin Noël
Browse files

marker-layer: Use g_signal_connect_object() to connect to markers

There's no guarantee that markers will be destroyed together with the marker
layer. In fact, applications can reuse markers through the already available
ShumateMarkerLayer API.

Avoid a potentially crashy callback by using g_signal_connect_object(), which
disconnects the signal automatically when the marker layer is destroyed.
parent dff38656
......@@ -444,10 +444,10 @@ shumate_marker_layer_add_marker (ShumateMarkerLayer *layer,
shumate_marker_set_selectable (marker, priv->mode != GTK_SELECTION_NONE);
g_signal_connect (G_OBJECT (marker), "notify::latitude",
G_CALLBACK (marker_position_notify), layer);
g_signal_connect (G_OBJECT (marker), "notify::longitude",
G_CALLBACK (marker_position_notify), layer);
g_signal_connect_object (G_OBJECT (marker), "notify::latitude",
G_CALLBACK (marker_position_notify), layer, 0);
g_signal_connect_object (G_OBJECT (marker), "notify::longitude",
G_CALLBACK (marker_position_notify), layer, 0);
/*g_signal_connect (G_OBJECT (marker), "drag-motion",
G_CALLBACK (marker_move_by_cb), layer);*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment