[libshumate] view: Stop using GSlice



commit e1ff5bead5caea9bf8803bb23c73ebd41f37a3e3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Mar 4 21:33:07 2021 -0300

    view: Stop using GSlice
    
    It is semi-officially deprecated. Also sneak in a small cleanup
    using g_clear_pointer().

 shumate/shumate-view.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/shumate/shumate-view.c b/shumate/shumate-view.c
index 3d9c338..fd4c9da 100644
--- a/shumate/shumate-view.c
+++ b/shumate/shumate-view.c
@@ -469,7 +469,7 @@ shumate_view_go_to_with_duration (ShumateView *view,
 
   shumate_view_stop_go_to (view);
 
-  ctx = g_slice_new (GoToContext);
+  ctx = g_new (GoToContext, 1);
   ctx->start_us = g_get_monotonic_time ();
   ctx->duration_us = ms_to_us (duration_ms);
   ctx->from_latitude = shumate_location_get_latitude (SHUMATE_LOCATION (priv->viewport));
@@ -903,8 +903,7 @@ shumate_view_stop_go_to (ShumateView *view)
     return;
 
   gtk_widget_remove_tick_callback (GTK_WIDGET (view), priv->goto_context->tick_id);
-  g_slice_free (GoToContext, priv->goto_context);
-  priv->goto_context = NULL;
+  g_clear_pointer (&priv->goto_context, g_free);
 
   g_signal_emit (view, signals[ANIMATION_COMPLETED], go_to_quark, NULL);
 }


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