QEasingCurve: simplify and fix copy constructor
authorMarc Mutz <marc.mutz@kdab.com>
Sun, 19 Feb 2012 19:53:20 +0000 (20:53 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 21 Feb 2012 14:28:40 +0000 (15:28 +0100)
commitae445b20fa2567f7e14d989f288edb69b0904433
treeb26307f8c862b75e08edfc2859fbf9539b4af13b
parent60f7473782b0a4deae11147631d846d7bc8e8bb2
QEasingCurve: simplify and fix copy constructor

The copy constructor used the default Private constructor,
followed by the application of the compiler-generated
copy assignment operator, and finally replaced the config
member with a copy of itself.

This is needlessly inefficient.

Worse: it's incorrect: if config->copy() throws, then
*d_ptr is leaked.

Solution: implement the copy constructor for Private,
and use it in the copy constructor of the public class.

Effect: everything that can throw now prevents the new
Private class from being created, and the compiler ends
up cleaning up after us.

Change-Id: I09ed18bb39ee7cd81aaa8ba01676fc202502a8e3
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/corelib/tools/qeasingcurve.cpp