[Development] What's the status of a moved-from object?
giuseppe.dangelo at kdab.com
Fri May 24 14:28:32 CEST 2019
Il 23/05/19 09:36, Simon Hausmann ha scritto:
> I think a well-formed state is more likely to enable our users to have a
> productive time. Operating - by accident - on a partially-formed object
> and either
> (1) seeing a back-trace that points into Qt, not my application code
> (2) spending time in the debugger stepping through Qt code
> is IMHO a direction that we should avoid.
To nitpick, in the proposed scenario, (2) shouldn't ever happen. In such
a scenario, the d-pointer checks would be replaced by something like
Q_ASSERT_X(d_ptr, "This object has been moved from"), which would fire
in a debug build of Qt. (1) is a bit more tricky as it wouldn't be
obvious at all what the problem is, although again, a debug build would
identify it immediately.
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4329 bytes
Desc: Firma crittografica S/MIME
More information about the Development