From 5420d74e34de13f548f86fa5b5f63fe54842fbe1 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 12 Aug 2008 17:51:38 +0300 Subject: [PATCH] MapWidget: ref/unref given TileRepo. Ignore if repo is same as before. --- libs/libgtkmap/gtkmap.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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); } -- 2.39.5