[libgdamm/libgdamm-4-2] Value: operator=(): Check for identical instance.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdamm/libgdamm-4-2] Value: operator=(): Check for identical instance.
- Date: Thu, 22 Sep 2011 09:22:18 +0000 (UTC)
commit 7a8f3e16302aeb21d67c1caa758aee5b52ef6fe7
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Sep 21 08:50:17 2011 +0200
Value: operator=(): Check for identical instance.
* libgda/libgdamm/value.cc: This is generally a good idea in operator=()
implementations.
ChangeLog | 7 +++++++
libgda/libgdamm/value.cc | 3 +++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c9c6d9e..f014073 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-21 Murray Cumming <murrayc murrayc com>
+
+ Value: operator=(): Check for identical instance.
+
+ * libgda/libgdamm/value.cc: This is generally a good idea in operator=()
+ implementations.
+
2011-09-20 Murray Cumming <murrayc murrayc com>
Value: operator=(): Check for the identical underlying GValue.
diff --git a/libgda/libgdamm/value.cc b/libgda/libgdamm/value.cc
index be143f0..216fb4e 100644
--- a/libgda/libgdamm/value.cc
+++ b/libgda/libgdamm/value.cc
@@ -221,6 +221,9 @@ Value::Value(const GValue* castitem)
Value& Value::operator=(const Value& src)
{
+ if(this == &src)
+ return *this;
+
//Avoid doing anything if no change is necessary:
if(gobj() == src.gobj())
return *this;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]