ChamplainCachePrivate *priv = GET_PRIVATE (object);
if (priv->stmt_select)
- sqlite3_finalize (priv->stmt_select);
+ {
+ sqlite3_finalize (priv->stmt_select);
+ priv->stmt_select = NULL;
+ }
if (priv->stmt_update)
- sqlite3_finalize (priv->stmt_update);
+ {
+ sqlite3_finalize (priv->stmt_update);
+ priv->stmt_update = NULL;
+ }
- error = sqlite3_close (priv->data);
- if (error != SQLITE_OK)
- DEBUG ("Sqlite returned error %d when closing cache.db", error);
+ if (priv->data != NULL)
+ {
+ error = sqlite3_close (priv->data);
+ if (error != SQLITE_OK)
+ DEBUG ("Sqlite returned error %d when closing cache.db", error);
+ priv->data = NULL;
+ }
G_OBJECT_CLASS (champlain_cache_parent_class)->dispose (object);
}
}
}
-static void
-champlain_layer_dispose (GObject *object)
-{
- //ChamplainLayerPrivate *priv = GET_PRIVATE (object);
-
- G_OBJECT_CLASS (champlain_layer_parent_class)->dispose (object);
-}
-
-static void
-champlain_layer_finalize (GObject *object)
-{
- G_OBJECT_CLASS (champlain_layer_parent_class)->finalize (object);
-}
-
static void
champlain_layer_class_init (ChamplainLayerClass *klass)
{
object_class->get_property = champlain_layer_get_property;
object_class->set_property = champlain_layer_set_property;
- object_class->dispose = champlain_layer_dispose;
- object_class->finalize = champlain_layer_finalize;
}
static void
{
ChamplainTilePrivate *priv = GET_PRIVATE (object);
- g_free (priv->uri);
- g_free (priv->filename);
if (priv->actor != NULL)
{
g_object_unref (G_OBJECT (priv->actor));
priv->actor = NULL;
}
- g_object_unref (priv->content_actor);
+
+ if (priv->content_actor != NULL)
+ {
+ g_object_unref (G_OBJECT (priv->content_actor));
+ priv->content_actor = NULL;
+ }
G_OBJECT_CLASS (champlain_tile_parent_class)->dispose (object);
}
static void
champlain_tile_finalize (GObject *object)
{
+ ChamplainTilePrivate *priv = GET_PRIVATE (object);
+
+ g_free (priv->uri);
+ g_free (priv->filename);
+
G_OBJECT_CLASS (champlain_tile_parent_class)->finalize (object);
}
GValue *value, GParamSpec *pspec);
static void champlain_view_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
-static void champlain_view_finalize (GObject *object);
static void champlain_view_dispose (GObject *object);
static void champlain_view_class_init (ChamplainViewClass *champlainViewClass);
static void champlain_view_init (ChamplainView *view);
{
ChamplainView *view = CHAMPLAIN_VIEW (object);
ChamplainViewPrivate *priv = view->priv;
- g_object_unref (priv->factory);
- g_object_unref (priv->map_source);
+
+ if (priv->factory)
+ {
+ g_object_unref (priv->factory);
+ priv->factory = NULL;
+ }
+
+ if (priv->map_source)
+ {
+ g_object_unref (priv->map_source);
+ priv->map_source = NULL;
+ }
+
if (priv->license_actor)
- g_object_unref (priv->license_actor);
- g_object_unref (priv->finger_scroll);
- g_object_unref (priv->viewport);
- g_object_unref (priv->map_layer);
- g_object_unref (priv->user_layers);
- g_object_unref (priv->stage);
+ {
+ g_object_unref (priv->license_actor);
+ priv->license_actor = NULL;
+ }
- map_free (priv->map);
+ if (priv->finger_scroll)
+ {
+ g_object_unref (priv->finger_scroll);
+ priv->finger_scroll = NULL;
+ }
+
+ if (priv->viewport)
+ {
+ g_object_unref (priv->viewport);
+ priv->viewport = NULL;
+ }
+
+ if (priv->map_layer)
+ {
+ g_object_unref (priv->map_layer);
+ priv->map_layer = NULL;
+ }
+
+ if (priv->user_layers)
+ {
+ g_object_unref (priv->user_layers);
+ priv->user_layers = NULL;
+ }
+
+ if (priv->stage)
+ {
+ g_object_unref (priv->stage);
+ priv->stage = NULL;
+ }
+
+ if (priv->map)
+ {
+ map_free (priv->map);
+ priv->map = NULL;
+ }
if (priv->goto_context)
g_free (priv->goto_context);
-}
-
-static void
-champlain_view_finalize (GObject *object)
-{
- /*
- ChamplainView *view = CHAMPLAIN_VIEW (object);
- ChamplainViewPrivate *priv = view->priv;
- */
- G_OBJECT_CLASS (champlain_view_parent_class)->finalize (object);
+ G_OBJECT_CLASS (champlain_view_parent_class)->dispose (object);
}
static void
g_type_class_add_private (champlainViewClass, sizeof (ChamplainViewPrivate));
GObjectClass *object_class = G_OBJECT_CLASS (champlainViewClass);
- object_class->finalize = champlain_view_finalize;
object_class->dispose = champlain_view_dispose;
object_class->get_property = champlain_view_get_property;
object_class->set_property = champlain_view_set_property;
ChamplainZoomLevel *level = CHAMPLAIN_ZOOM_LEVEL (object);
ChamplainZoomLevelPrivate *priv = level->priv;
- g_object_unref (priv->actor);
+ if (priv->actor != NULL)
+ {
+ g_object_unref (priv->actor);
+ priv->actor = NULL;
+ }
- // Get rid of old tiles first
- for (k = 0; k < champlain_zoom_level_tile_count (level); k++)
+ if (priv->tiles != NULL)
{
- ChamplainTile *tile = champlain_zoom_level_get_nth_tile (level, k);
- champlain_zoom_level_remove_tile (level, tile);
+ for (k = 0; k < champlain_zoom_level_tile_count (level); k++)
+ {
+ ChamplainTile *tile = champlain_zoom_level_get_nth_tile (level, k);
+ champlain_zoom_level_remove_tile (level, tile);
+ }
+ g_ptr_array_free (priv->tiles, TRUE);
+ priv->tiles = NULL;
}
- g_ptr_array_free (priv->tiles, TRUE);
G_OBJECT_CLASS (champlain_zoom_level_parent_class)->dispose (object);
}