From: Pierre-Luc Beaudoin Date: Sun, 14 Jun 2009 17:56:33 +0000 (-0400) Subject: Fix a warning on remove_polygon when the view is still 0,0 in size X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1da5449c8da8e5ab7e83557decc3899fca883a1c;p=libchamplain Fix a warning on remove_polygon when the view is still 0,0 in size --- diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index 95109bb..064ba93 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -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); }