[libgdamm] Value: operator=(): Check for the identical underlying GValue.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdamm] Value: operator=(): Check for the identical underlying GValue.
- Date: Tue, 20 Sep 2011 21:23:36 +0000 (UTC)
commit 07e000be59868776c509eb6af3308eea690eb3b8
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Sep 20 23:23:30 2011 +0200
Value: operator=(): Check for the identical underlying GValue.
* libgda/libgdamm/value.cc: Otherwise we unset the gobject, which
unsets the src, because it is the same gobject, and then we reject that
src as invalid.
ChangeLog | 8 ++++++++
libgda/libgdamm/value.cc | 11 +++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d417ee8..29985a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-20 Murray Cumming <murrayc murrayc com>
+
+ Value: operator=(): Check for the identical underlying GValue.
+
+ * libgda/libgdamm/value.cc: Otherwise we unset the gobject, which
+ unsets the src, because it is the same gobject, and then we reject that
+ src as invalid.
+
4.99.3.1:
2011-07-04 Murray Cumming <murrayc murrayc com>
diff --git a/libgda/libgdamm/value.cc b/libgda/libgdamm/value.cc
index 2df7223..b2e79b7 100644
--- a/libgda/libgdamm/value.cc
+++ b/libgda/libgdamm/value.cc
@@ -216,10 +216,17 @@ Value::Value(const GValue* castitem)
Value& Value::operator=(const Value& src)
{
+ //Avoid doing anything if no change is necessary:
+ if(gobj() == src.gobj())
+ return *this;
+
// Unset current value, if any
- if(G_IS_VALUE(gobj())) g_value_unset(gobj());
+ if(G_IS_VALUE(gobj()))
+ g_value_unset(gobj());
+
// Set new value, if any
- if(G_IS_VALUE(src.gobj())) init(src.gobj());
+ if(G_IS_VALUE(src.gobj()))
+ init(src.gobj());
return *this;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]