[libchamplain/libchamplain-0-4] Add a weak pointer to draw polygon's context



commit 03163483191593bdc82ce6d604f1f592815af5a9
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Wed Dec 16 18:45:16 2009 -0500

    Add a weak pointer to draw polygon's context
    
    Bug 604784: SIGSEGV in function cairo_set_operator

 champlain/champlain-view.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index fff3d2b..7f3f2ae 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -445,7 +445,10 @@ draw_polygon (ChamplainView *view, ChamplainPolygon *polygon)
 static gboolean
 redraw_polygon_on_idle (PolygonRedrawContext *ctx)
 {
-  draw_polygon (ctx->view, ctx->polygon);
+
+  if (ctx->polygon)
+    draw_polygon (ctx->view, ctx->polygon);
+
   ctx->view->priv->polygon_redraw_id = 0;
   // ctx is freed by g_idle_add_full
   return FALSE;
@@ -464,6 +467,7 @@ notify_polygon_cb (ChamplainPolygon *polygon,
   ctx = g_new0 (PolygonRedrawContext, 1);
   ctx->view = view;
   ctx->polygon = polygon;
+  g_object_add_weak_pointer (polygon, &ctx->polygon);
 
   view->priv->polygon_redraw_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
       (GSourceFunc) redraw_polygon_on_idle, ctx, g_free);



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