diff options
author | Murray Cumming <murrayc@murrayc.com> | 2008-03-28 16:31:17 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2008-03-28 16:31:17 +0000 |
commit | fd4f5b039334e143b24e7e7d3d21e8129268ae41 (patch) | |
tree | 4e5b09fd934e769fb856c47126a7c6dfa37cb53a /gio | |
parent | cbbb33c44be4b30e23a484ec2b0282689c819115 (diff) | |
download | glibmm-fd4f5b039334e143b24e7e7d3d21e8129268ae41.tar.gz |
create(), replace(): Do not take an extra reference, because the C
2008-03-28 Murray Cumming <murrayc@murrayc.com>
* gio/src/file.ccg: create(), replace(): Do not take an extra reference,
because the C function has given us a new instance with an initial
reference. The leak stopped the stream from really replacing the file,
because that only happens when it is closed.
svn path=/trunk/; revision=645
Diffstat (limited to 'gio')
-rw-r--r-- | gio/src/file.ccg | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/gio/src/file.ccg b/gio/src/file.ccg index 15b2838a..b437b76c 100644 --- a/gio/src/file.ccg +++ b/gio/src/file.ccg @@ -287,7 +287,7 @@ Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancell #endif //GLIBMM_EXCEPTIONS_ENABLED if(retvalue) - retvalue->reference(); //The function does not do a ref for us. + retvalue->reference(); //The function does not do a ref for us. //TODO: Or maybe it's a new instance. murrayc. return retvalue; } @@ -308,7 +308,7 @@ Glib::RefPtr<FileInfo> File::query_info(const std::string& attributes, FileQuery #endif //GLIBMM_EXCEPTIONS_ENABLED if(retvalue) - retvalue->reference(); //The function does not do a ref for us. + retvalue->reference(); //The function does not do a ref for us. //TODO: Or maybe it's a new instance. murrayc. return retvalue; } @@ -370,7 +370,7 @@ Glib::RefPtr<FileInfo> File::query_filesystem_info(const Glib::RefPtr<Cancellabl #endif //GLIBMM_EXCEPTIONS_ENABLED if(retvalue) - retvalue->reference(); //The function does not do a ref for us. + retvalue->reference(); //The function does not do a ref for us. //TODO: Or maybe it's a new instance. murrayc. return retvalue; } @@ -391,7 +391,7 @@ Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes #endif //GLIBMM_EXCEPTIONS_ENABLED if(retvalue) - retvalue->reference(); //The function does not do a ref for us. + retvalue->reference(); //The function does not do a ref for us. //TODO: Or maybe it's a new instance. murrayc. return retvalue; } @@ -516,7 +516,7 @@ Glib::RefPtr<File> File::set_display_name(const Glib::ustring& display_name, std #endif //GLIBMM_EXCEPTIONS_ENABLED if(retvalue) - retvalue->reference(); //The function does not do a ref for us. + retvalue->reference(); //The function does not do a ref for us. //TODO: Or maybe it returns a new instance. It's not clear. murrayc. return retvalue; } @@ -1532,8 +1532,6 @@ Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& ca error = ::Glib::Error::throw_exception(gerror); #endif //GLIBMM_EXCEPTIONS_ENABLED - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. return retvalue; } @@ -1553,8 +1551,6 @@ Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_ error = ::Glib::Error::throw_exception(gerror); #endif //GLIBMM_EXCEPTIONS_ENABLED - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. return retvalue; } @@ -1650,8 +1646,6 @@ Glib::RefPtr<FileInputStream> File::read(std::auto_ptr<Glib::Error>& error) error = ::Glib::Error::throw_exception(gerror); #endif //GLIBMM_EXCEPTIONS_ENABLED - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. return retvalue; } @@ -1793,8 +1787,6 @@ Glib::RefPtr<FileOutputStream> File::create_file(const Glib::RefPtr<Cancellable> error = ::Glib::Error::throw_exception(gerror); #endif //GLIBMM_EXCEPTIONS_ENABLED - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. return retvalue; } @@ -1814,8 +1806,6 @@ Glib::RefPtr<FileOutputStream> File::create_file(FileCreateFlags flags, std::aut error = ::Glib::Error::throw_exception(gerror); #endif //GLIBMM_EXCEPTIONS_ENABLED - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. return retvalue; } @@ -1950,8 +1940,6 @@ Glib::RefPtr<FileOutputStream> File::append_to(const Glib::RefPtr<Cancellable>& error = ::Glib::Error::throw_exception(gerror); #endif //GLIBMM_EXCEPTIONS_ENABLED - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. return retvalue; } @@ -1971,8 +1959,6 @@ Glib::RefPtr<FileOutputStream> File::append_to(FileCreateFlags flags, std::auto_ error = ::Glib::Error::throw_exception(gerror); #endif //GLIBMM_EXCEPTIONS_ENABLED - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. return retvalue; } @@ -2012,7 +1998,7 @@ Glib::RefPtr<AppInfo> File::query_default_handler(std::auto_ptr<Glib::Error>& er #endif //GLIBMM_EXCEPTIONS_ENABLED if(retvalue) - retvalue->reference(); //The function does not do a ref for us. + retvalue->reference(); //The function does not do a ref for us. //TODO: Or maybe it's a new instance. murrayc. return retvalue; } |