[glom/glom-1-30] DialogImageLoadProgress::get_image_data(): Give ownership of the GdaBinary.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-30] DialogImageLoadProgress::get_image_data(): Give ownership of the GdaBinary.
- Date: Thu, 25 Feb 2016 13:32:18 +0000 (UTC)
commit 92e95064cfe627e4f74e7726508dd59402b0875d
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Feb 25 14:08:58 2016 +0100
DialogImageLoadProgress::get_image_data(): Give ownership of the GdaBinary.
This seems to fix the crash when choosing an image repeatedly:
https://bugzilla.gnome.org/show_bug.cgi?id=761396#c13
glom/utility_widgets/dialog_image_load_progress.cc | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/glom/utility_widgets/dialog_image_load_progress.cc
b/glom/utility_widgets/dialog_image_load_progress.cc
index 7f4142c..680c878 100644
--- a/glom/utility_widgets/dialog_image_load_progress.cc
+++ b/glom/utility_widgets/dialog_image_load_progress.cc
@@ -52,7 +52,7 @@ DialogImageLoadProgress::DialogImageLoadProgress(BaseObjectType* cobject, const
DialogImageLoadProgress::~DialogImageLoadProgress()
{
- if(m_data.get())
+ if(m_data)
g_free(m_data->data);
// TODO: Cancel outstanding async operations in destructor?
@@ -63,7 +63,7 @@ void DialogImageLoadProgress::load(const Glib::ustring& uri)
// Can only load one file with data
g_assert(!m_data.get());
- m_data.reset(new GdaBinary);
+ m_data = std::make_shared<GdaBinary>();
m_data->data = nullptr;
m_data->binary_length = 0;
@@ -167,7 +167,9 @@ void DialogImageLoadProgress::error(const Glib::ustring& error_message)
std::shared_ptr<GdaBinary> DialogImageLoadProgress::get_image_data()
{
- return m_data;
+ auto result = m_data;
+ m_data.reset();
+ return result;
}
} // namespace Glom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]