]> err.no Git - libchamplain/commitdiff
Fix a warning on remove_polygon when the view is still 0,0 in size
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sun, 14 Jun 2009 17:56:33 +0000 (13:56 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sun, 14 Jun 2009 17:56:33 +0000 (13:56 -0400)
champlain/champlain-view.c

index 95109bb869c0a3ec87ecc8dcbf56d39f437c6bf2..064ba93044c51d14da682d90ded07da83d1ed614 100644 (file)
@@ -2396,7 +2396,10 @@ champlain_view_add_polygon (ChamplainView *view,
 
   if (view->priv->viewport_size.width == 0 ||
       view->priv->viewport_size.height == 0)
+  {
+    polygon->priv->actor = NULL;
     return;
+  }
 
   polygon->priv->actor = g_object_ref (clutter_cairo_new (
       view->priv->viewport_size.width,
@@ -2425,7 +2428,10 @@ champlain_view_remove_polygon (ChamplainView *view,
   g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
 
   view->priv->polygons = g_list_remove (view->priv->polygons, polygon);
-  clutter_container_remove_actor (CLUTTER_CONTAINER (view->priv->polygon_layer),
-      polygon->priv->actor);
+
+  if (polygon->priv->actor != NULL)
+    clutter_container_remove_actor (CLUTTER_CONTAINER (view->priv->polygon_layer),
+        polygon->priv->actor);
+
   g_object_unref (polygon);
 }