diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-02-19 20:55:09 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-21 19:15:48 +0100 |
commit | ca588f40db9cb1ba0e3f223ca031b18524be4a09 (patch) | |
tree | de18a030b3a6ac517ed51fc77271fcb08344a7ca /src/corelib/tools/qeasingcurve.cpp | |
parent | 4fc6bc480408b24509d449a4c26f2dcab18eaaee (diff) |
QEasingCurve: implement copy assignment operator inline
Implement the copy-assignment operator inline, using the
copy-swap idiom. This makes assignment strongly exception
safe, but also simplifies maintainence, because op= is
formulated in terms of the copy constructor now.
Change-Id: I803c9100a520d659b685992237cb76fd114222c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qeasingcurve.cpp')
-rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 7a47262798..1ca9a55d72 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1100,22 +1100,9 @@ QEasingCurve::~QEasingCurve() } /*! + \fn QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other) Copy \a other. */ -QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other) -{ - // ### non-atomic, requires malloc on shallow copy - if (d_ptr->config) { - delete d_ptr->config; - d_ptr->config = 0; - } - - *d_ptr = *other.d_ptr; - if (other.d_ptr->config) - d_ptr->config = other.d_ptr->config->copy(); - - return *this; -} /*! \fn void QEasingCurve::swap(QEasingCurve &other) |