From: Kaj-Michael Lang Date: Tue, 12 Aug 2008 14:51:38 +0000 (+0300) Subject: MapWidget: ref/unref given TileRepo. Ignore if repo is same as before. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5420d74e34de13f548f86fa5b5f63fe54842fbe1;p=mapper MapWidget: ref/unref given TileRepo. Ignore if repo is same as before. --- diff --git a/libs/libgtkmap/gtkmap.c b/libs/libgtkmap/gtkmap.c index 2dd76b9..2de1fb6 100644 --- a/libs/libgtkmap/gtkmap.c +++ b/libs/libgtkmap/gtkmap.c @@ -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); }