[nautilus-actions] Do not unref here removed item
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Do not unref here removed item
- Date: Thu, 24 Jun 2010 21:04:06 +0000 (UTC)
commit 17514c920967263fe053905934510bfcf0da2658
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jun 24 17:18:10 2010 +0200
Do not unref here removed item
ChangeLog | 7 +++++++
src/core/na-updater.c | 18 +++++++++---------
src/nact/nact-main-window.c | 1 +
3 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 425094c..0bd3f4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-06-23 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-updater.c (na_updater_remove_item):
+ Do not unref here removed item.
+ Also remove item from non level zero parent.
+
+ * src/nact/nact-main-window.c (actually_delete_item):
+ Updated accordingly.
+
* src/core/na-icontext.c (is_candidate_for_try_exec):
Do not try to get info for non existing file.
diff --git a/src/core/na-updater.c b/src/core/na-updater.c
index 9296b44..1103d61 100644
--- a/src/core/na-updater.c
+++ b/src/core/na-updater.c
@@ -250,17 +250,13 @@ na_updater_insert_item( NAUpdater *updater, NAObjectItem *item, const gchar *par
* @updater: this #NAPivot instance.
* @item: the #NAObjectItem to be removed from the list.
*
- * Removes a #NAObjectItem from the hierarchical tree.
- *
- * Note that #NAUpdater also g_object_unref() the removed #NAObjectItem.
- *
- * Last, note that the @item may have been already deleted, when its
- * parents has itself been removed from @updater.
+ * Removes a #NAObjectItem from the hierarchical tree. Does not delete it.
*/
void
na_updater_remove_item( NAUpdater *updater, NAObject *item )
{
GList *tree;
+ NAObjectItem *parent;
g_debug( "na_updater_remove_item: updater=%p, item=%p (%s)",
( void * ) updater,
@@ -270,13 +266,17 @@ na_updater_remove_item( NAUpdater *updater, NAObject *item )
if( !updater->private->dispose_has_run ){
- if( !na_object_get_parent( item )){
+ parent = na_object_get_parent( item );
+ if( parent ){
+ tree = na_object_get_items( parent );
+ tree = g_list_remove( tree, ( gconstpointer ) item );
+ na_object_set_items( parent, tree );
+
+ } else {
g_object_get( G_OBJECT( updater ), NAPIVOT_PROP_TREE, &tree, NULL );
tree = g_list_remove( tree, ( gconstpointer ) item );
g_object_set( G_OBJECT( updater ), NAPIVOT_PROP_TREE, tree, NULL );
}
-
- g_object_unref( item );
}
}
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index d90f8c7..7062458 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -1026,6 +1026,7 @@ actually_delete_item( NactMainWindow *window, NAObject *item, NAUpdater *updater
origin = ( NAObject * ) na_object_get_origin( item );
if( origin ){
na_updater_remove_item( updater, origin );
+ g_object_unref( origin );
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]