Skip to content

Commit

Permalink
Fix unbalanced GC create/free calls in GPS Layer
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorris committed Jan 18, 2025
1 parent 5411694 commit c97fedd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/vikgpslayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,13 @@ static VikLayerParamData gps_layer_get_param ( VikGpsLayer *vgl, guint16 id, gbo
}

#if defined (VIK_CONFIG_REALTIME_GPS_TRACKING) && defined (GPSD_API_MAJOR_VERSION)
static void gc_create_rt ( VikGpsLayer *vgl, VikViewport *vp )
{
vgl->realtime_track_gc = vik_viewport_new_gc_from_color ( vp, &(vgl->indicator_color), 2 );
}

// Note that realtime_track_gc is NOT created here
// and must be done separately in gc_create_rt() above
static void gcs_create ( VikGpsLayer *vgl, VikViewport *vp )
{
vgl->realtime_track_bg_gc = vik_viewport_new_gc ( vp, "grey", 2 );
Expand Down Expand Up @@ -839,6 +846,7 @@ static void gps_layer_configure ( VikGpsLayer *vgl, VikViewport *vp )
#if defined (VIK_CONFIG_REALTIME_GPS_TRACKING) && defined (GPSD_API_MAJOR_VERSION)
gcs_free ( vgl );
gcs_create ( vgl, vp );
gc_create_rt ( vgl, vp );
#endif
}

Expand Down Expand Up @@ -2160,6 +2168,6 @@ static void layer_update_indictor_gc (VikGpsLayer *vgl, VikViewport *vp)
{
if ( vgl->realtime_track_gc )
ui_gc_unref ( vgl->realtime_track_gc );
vgl->realtime_track_gc = vik_viewport_new_gc_from_color ( vp, &(vgl->indicator_color), 2 );
gc_create_rt ( vgl, vp );
}
#endif /* VIK_CONFIG_REALTIME_GPS_TRACKING */

0 comments on commit c97fedd

Please sign in to comment.