static void
midori_history_disconnect_folder (MidoriHistory* history,
- KatzeArray* array)
+ KatzeArray* array,
+ gboolean unref)
{
KatzeItem* item;
guint i;
while ((item = katze_array_get_nth_item (array, i++)))
{
if (KATZE_IS_ARRAY (item))
- midori_history_disconnect_folder (history, KATZE_ARRAY (item));
- g_object_unref (item);
+ midori_history_disconnect_folder (history, KATZE_ARRAY (item), TRUE);
+ if (unref)
+ g_object_unref (item);
}
}
g_return_if_fail (KATZE_IS_ARRAY (array));
g_return_if_fail (KATZE_IS_ITEM (added_item));
+ g_return_if_fail (MIDORI_IS_HISTORY (history));
if (KATZE_IS_ARRAY (added_item))
{
g_assert (KATZE_IS_ITEM (removed_item));
if (KATZE_IS_ARRAY (removed_item))
- midori_history_disconnect_folder (history, KATZE_ARRAY (removed_item));
+ midori_history_disconnect_folder (history, KATZE_ARRAY (removed_item), TRUE);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (history->treeview));
midori_history_remove_iter (model, NULL, removed_item);
midori_history_remove_item_cb (array, item, history);
}
- midori_history_disconnect_folder (history, array);
+ midori_history_disconnect_folder (history, array, TRUE);
}
static void
if (history->array)
{
- midori_history_disconnect_folder (history, history->array);
+ midori_history_disconnect_folder (history, history->array, TRUE);
g_object_unref (history->array);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (history->treeview));
gtk_tree_store_clear (GTK_TREE_STORE (model));
if (history->app)
g_object_unref (history->app);
+
+ /* FIXME: We don't unref items (last argument is FALSE) because
+ our reference counting is incorrect. */
+ midori_history_disconnect_folder (history, history->array, FALSE);
+
g_object_unref (history->array);
}