]> err.no Git - mapper/commitdiff
MapWidget: ref/unref given TileRepo. Ignore if repo is same as before.
authorKaj-Michael Lang <milang@tal.org>
Tue, 12 Aug 2008 14:51:38 +0000 (17:51 +0300)
committerKaj-Michael Lang <milang@tal.org>
Tue, 12 Aug 2008 14:51:38 +0000 (17:51 +0300)
libs/libgtkmap/gtkmap.c

index 2dd76b91763477b19cb5ad68f47faba4f821f40c..2de1fb625a9f6a69bc0fcf100963582e23343c6a 100644 (file)
@@ -1836,10 +1836,21 @@ g_return_if_fail(GTK_IS_MAP(widget));
 map=GTK_MAP(widget);
 priv=GTK_MAP_GET_PRIVATE(map);
 
-g_return_if_fail(rd);
+if (rd==NULL) {
+       if (priv->curr_repo)
+               g_object_unref(priv->curr_repo);
+       priv->curr_repo=NULL;
+} else {
+       g_return_if_fail(IS_TILE_REPO(rd));
 
-priv->curr_repo=rd;
+       if (priv->curr_repo==rd)
+               return;
 
+       g_object_ref(rd);
+       if (priv->curr_repo)
+               g_object_unref(priv->curr_repo);
+       priv->curr_repo=rd;
+}
 gtk_map_refresh(widget);
 }