[nautilus-actions] Increment the reference count of the returned location



commit f0ed025d104e4222cabcd258155dbeb00bd9d5f3
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Apr 14 21:18:38 2010 +0200

    Increment the reference count of the returned location
    
    This prevents Nautilus to crash when trying to free the NASelectedInfo list.

 ChangeLog                   |    3 +++
 src/core/na-selected-info.c |    6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index efaf44b..ff7b2a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-04-14 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-selected-info.c (na_selected_info_get_location):
+	Increment the reference count of the returned location.
+
 	* src/core/na-gconf-utils.c (dump_entry):
 	Do not try to dump a null value.
 
diff --git a/src/core/na-selected-info.c b/src/core/na-selected-info.c
index d235105..9c6b3d2 100644
--- a/src/core/na-selected-info.c
+++ b/src/core/na-selected-info.c
@@ -261,7 +261,9 @@ na_selected_info_free_list( GList *list )
  * na_selected_info_get_location:
  * @nsi: this #NASelectedInfo object.
  *
- * Returns: a pointer to the #GFile location.
+ * Returns: a new reference to the #GFile location.
+ *
+ * The returned location should be g_object_unref() by the caller.
  */
 GFile *
 na_selected_info_get_location( const NASelectedInfo *nsi )
@@ -274,7 +276,7 @@ na_selected_info_get_location( const NASelectedInfo *nsi )
 
 	if( !nsi->private->dispose_has_run ){
 
-		location = nsi->private->location;
+		location = g_object_ref( nsi->private->location );
 	}
 
 	return( location );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]