summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--gio/src/file.ccg26
2 files changed, 13 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 22df62f1..79ca7fbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
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.
+
+2008-03-28 Murray Cumming <murrayc@murrayc.com>
+
* gio/src/file.hg:
* gio/src/outputstream.hg: Documentation: Remove/fix mentions of 0 when
we mean something else.
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;
}