[glibmm/glibmm-2-34] Gio::File: Remove refreturn to avoid memory leaks.



commit 855c956205afd31a2b141c22fa2986580991c41e
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Mon Jan 14 19:39:32 2013 +0100

    Gio::File: Remove refreturn to avoid memory leaks.
    
    * gio/src/file.hg: Remove the refreturn argument from _WRAP_METHOD for read()
    and 13 other methods. The glib functions add a ref.
    Change @newin2p24 to @newin{2,24}. Bug #691606.

 ChangeLog       |    8 +++++
 gio/src/file.hg |   89 +++++++++++++++++++++++--------------------------------
 2 files changed, 45 insertions(+), 52 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b4b035e..396446e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-01-14  Kjell Ahlstedt  <kjell ahlstedt bredband net>
+
+	Gio::File: Remove refreturn to avoid memory leaks.
+
+	* gio/src/file.hg: Remove the refreturn argument from _WRAP_METHOD for read()
+	and 13 other methods. The glib functions add a ref.
+	Change @newin2p24 to @newin{2,24}. Bug #691606.
+
 2012-12-14  Andrew Potter  <agpotter gmail com>
 
 	SimpleAction: Fix stateful action constructor typo, allowing use.
diff --git a/gio/src/file.hg b/gio/src/file.hg
index b0b07ed..263d77f 100644
--- a/gio/src/file.hg
+++ b/gio/src/file.hg
@@ -87,9 +87,6 @@ class File : public Glib::Interface
 
 public:
 
-
-
-
   _IGNORE(g_file_icon_new) //g_file_icon_new is not a GFile method.
 
   // Although this is an interface, it is possible to create objects using
@@ -148,7 +145,7 @@ public:
   _WRAP_METHOD(std::string get_uri() const, g_file_get_uri)
   _WRAP_METHOD(Glib::ustring get_parse_name() const, g_file_get_parse_name)
 
-  //Note that these return a reference (usually new instances,
+  //Note that these return a reference (usually new instances),
   //so we don't need to use refreturn.
 
   //TODO: Do we need const and unconst versions of these get_*() methods,
@@ -163,7 +160,7 @@ public:
   /** Checks if the file has any parent at all.
    * @result true if the file is a child of any parent.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   bool has_parent() const;
 
@@ -189,7 +186,7 @@ public:
   //TODO: We don't have both const and unconst versions because a FileInputStream can't really change the File.
   _WRAP_METHOD(Glib::RefPtr<FileInputStream> read(const Glib::RefPtr<Cancellable>& cancellable{?}),
                g_file_read,
-               refreturn, errthrow)
+               errthrow)
 
   /** Asynchronously opens the file for reading.
    * For more details, see read() which is the synchronous version of this call.
@@ -213,7 +210,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<FileInputStream> read_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_read_finish,
-               refreturn, errthrow)
+               errthrow)
 
 
   /** Gets an output stream for appending data to the file. If
@@ -468,8 +465,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<FileOutputStream> append_to_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_append_to_finish,
-               refreturn, errthrow)
-
+               errthrow)
 
   //We renamed this to create_file_async from (g_file_create_async() and g_file_create_readwrite_async), to avoid confusion with static create() methods,
   //but I would still like to choose a different word, but can't think of a good one. murrayc. See also create_file().
@@ -500,7 +496,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<FileOutputStream> create_file_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_create_finish,
-               refreturn, errthrow)
+               errthrow)
 
 
   /** Asynchronously creates a new file and returns a stream for reading and
@@ -515,7 +511,7 @@ public:
    * @param flags a set of FileCreateFlags.
    * @param io_priority The I/O priority of the request.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void create_file_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT);
 
@@ -530,15 +526,14 @@ public:
    * @param flags a set of FileCreateFlags.
    * @param io_priority The I/O priority of the request.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void create_file_readwrite_async(const SlotAsyncReady& slot, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT);
   _IGNORE(g_file_create_readwrite_async)
 
   _WRAP_METHOD(Glib::RefPtr<FileIOStream> create_file_readwrite_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_create_readwrite_finish,
-               refreturn, errthrow)
-
+               errthrow)
 
   /** Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
    * For more details, see replace() which is the synchronous version of this call.
@@ -568,12 +563,11 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<FileOutputStream> replace_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_replace_finish,
-               refreturn, errthrow)
-
+               errthrow)
 
   _WRAP_METHOD(Glib::RefPtr<FileIOStream> open_readwrite(const Glib::RefPtr<Cancellable>& cancellable{?}),
                g_file_open_readwrite,
-               refreturn, errthrow)
+               errthrow)
 
   /** Opens an existing file for reading and writing.
    * The result is a FileIOStream that can be used to read and write the contents of the file.
@@ -592,7 +586,7 @@ public:
    * @param cancellable A Cancellable object which can be used to cancel the operation.
    * @param io_priority The I/O priority of the request.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void open_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
 
@@ -612,15 +606,14 @@ public:
    * @param slot A callback slot which will be called when the request is satisfied.
    * @param io_priority The I/O priority of the request.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void open_readwrite_async(const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
   _IGNORE(g_file_open_readwrite_async)
 
   _WRAP_METHOD(Glib::RefPtr<FileIOStream> open_readwrite_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_open_readwrite_finish,
-               refreturn, errthrow)
-
+               errthrow)
 
   /** Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first.
    *
@@ -637,7 +630,7 @@ public:
    * @param flags A set of FileCreateFlags.
    * @return A FileOutputStream.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   Glib::RefPtr<FileIOStream> replace_readwrite(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE);
 
@@ -657,7 +650,7 @@ public:
    * @param flags A set of FileCreateFlags.
    * @return A FileOutputStream.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   Glib::RefPtr<FileIOStream> replace_readwrite(const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE);
 
@@ -677,7 +670,7 @@ public:
    * @param flags A set of FileCreateFlags.
    * @param io_priority The I/O priority of the request.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void replace_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT);
 
@@ -692,19 +685,14 @@ public:
    * @param flags A set of FileCreateFlags.
    * @param io_priority The I/O priority of the request.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void replace_readwrite_async(const SlotAsyncReady& slot, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT);
   _IGNORE(g_file_replace_readwrite_async)
 
   _WRAP_METHOD(Glib::RefPtr<FileIOStream> replace_readwrite_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_replace_readwrite_finish,
-               refreturn, errthrow)
-
-
-
-
-
+               errthrow)
 
   /** Gets the requested information about the file. The result
    * is a FileInfo object that contains key-value attributes (such as the  type or size
@@ -816,7 +804,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<FileInfo> query_info_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_query_info_finish,
-               refreturn, errthrow)
+               errthrow)
 
   /** Similar to query_info(), but obtains information
    * about the filesystem the file is on, rather than the file itself.
@@ -870,8 +858,7 @@ public:
   _IGNORE(g_file_query_filesystem_info)
 
   _WRAP_METHOD(Glib::RefPtr<Mount> find_enclosing_mount(const Glib::RefPtr<Cancellable>& cancellable{?}),
-               g_file_find_enclosing_mount, retreturn, errthrow)
-
+               g_file_find_enclosing_mount, errthrow)
 
   /** Asynchronously gets the requested information about the filesystem
    * that the file is on. The result is a FileInfo object
@@ -905,10 +892,9 @@ public:
   void query_filesystem_info_async(const SlotAsyncReady& slot, const std::string& attributes = "*", int io_priority = Glib::PRIORITY_DEFAULT) const;
   _IGNORE(g_file_query_filesystem_info_async)
 
-
   _WRAP_METHOD(Glib::RefPtr<FileInfo> query_filesystem_info_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_query_filesystem_info_finish,
-               refreturn, errthrow)
+               errthrow)
 
   /** Asynchronously gets the mount for the file.
    *
@@ -939,8 +925,7 @@ public:
   _IGNORE(g_file_find_enclosing_mount_async)
 
   _WRAP_METHOD(Glib::RefPtr<Mount> find_enclosing_mount_finish(const Glib::RefPtr<AsyncResult>& result),
-               g_file_find_enclosing_mount_finish, refreturn, errthrow)
-
+               g_file_find_enclosing_mount_finish, errthrow)
 
   /** Gets the requested information about the files in a directory. The result
    * is a FileEnumerator object that will give out FileInfo objects for
@@ -1027,7 +1012,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<File> set_display_name(const Glib::ustring& display_name, const Glib::RefPtr<Cancellable>& cancellable{?}),
                g_file_set_display_name,
-               refreturn, errthrow)
+               errthrow)
 
   /** Asynchronously sets the display name for a given Gio::File. For the synchronous version of this function, see set_display_name().
    * When the operation is finished, @a slot will be called. You can then call set_display_name_finish() to get the result of the operation.
@@ -1467,7 +1452,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<File> mount_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_mount_mountable_finish,
-               refreturn, errthrow)
+               errthrow)
 
   /** Unmounts a file of type FILE_TYPE_MOUNTABLE.
    *
@@ -1509,7 +1494,7 @@ public:
    * @param mount_operation A MountOperation
    * @param flags Flags affecting the operation.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1521,7 +1506,7 @@ public:
    * @param mount_operation A MountOperation
    * @param flags Flags affecting the operation.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1530,7 +1515,7 @@ public:
    * @param mount_operation A MountOperation
    * @param flags Flags affecting the operation.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void unmount_mountable(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1580,7 +1565,7 @@ public:
    * @param mount_operation A MountOperation
    * @param flags Flags affecting the operation.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1592,7 +1577,7 @@ public:
    * @param mount_operation A MountOperation
    * @param flags Flags affecting the operation.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1601,7 +1586,7 @@ public:
    * @param mount_operation A MountOperation
    * @param flags Flags affecting the operation.
    *
-   * @newin2p24
+   * @newin{2,24}
    */
   void eject_mountable(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1735,7 +1720,7 @@ public:
   * @param cancellable A Cancellable object.
   * @param flags Flags affecting the operation
   *
-  * @newin2p24
+  * @newin{2,24}
   */
   void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& start_operation, DriveStartFlags flags = DRIVE_START_NONE);
 
@@ -1754,7 +1739,7 @@ public:
   * @param cancellable A Cancellable object.
   * @param flags Flags affecting the operation
   *
-  * @newin2p24
+  * @newin{2,24}
   */
   void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& start_operation, DriveStartFlags flags =  DRIVE_START_NONE);
   _IGNORE(g_file_start_mountable)
@@ -1778,7 +1763,7 @@ public:
   * @param cancellable A Cancellable object.
   * @param flags Flags affecting the operation
   *
-  * @newin2p24
+  * @newin{2,24}
   */
   void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& start_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1798,7 +1783,7 @@ public:
   * @param start_operation A Cancellable object.
   * @param flags Flags affecting the operation
   *
-  * @newin2p24
+  * @newin{2,24}
   */
   void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& start_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
   _IGNORE(g_file_stop_mountable)
@@ -1821,7 +1806,7 @@ public:
   * @param slot: A callback to call when the request is satisfied.
   * @param cancellable A Cancellable object.
   *
-  * @newin2p24
+  * @newin{2,24}
   */
   void poll_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
 
@@ -1839,7 +1824,7 @@ public:
   *
   * @param slot: A callback to call when the request is satisfied.
   *
-  * @newin2p24
+  * @newin{2,24}
   */
   void poll_mountable(const SlotAsyncReady& slot);
   _IGNORE(g_file_poll_mountable)



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