Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Le 15/01/2011 18:16, Caolán McNamara a écrit :
On Sat, 2011-01-15 at 00:03 +0100, Julien Nabet wrote:
Question :
In the last "git-updated" cppcheck I use, i found this in core part of
dbaccess :
[./api/query.cxx:310]: (error) instance of "OAutoActionReset" object
destroyed immediately

I took a look and I don't understand what's the use of this class.
in query.cxx, we have this :
Could someone explain the meaning of all this ?
Well, first off, if
OAutoActionReset(this);
is changed to
OAutoActionReset aResetter(this);
does the warning go away ?

Yes it removes the warning and there's no cppcheck pb in it. (I let you make the change since you have a direct git access)

I believe the intent is that an OAutoActionReset will set
m_eDoingCurrently to NONE in its dtor, so the idea is that when an
OAutoActionReset goes out of scope that dtor gets called, which would
mean that m_eDoingCurrently gets reset after the "if" ends in the normal
course of things.

*Or* if an exception is thrown, seeing as dtors are called when an
exception is thrown, which is probably the real meat of the construct,
i.e. "make sure to reset m_eDoingCurrently to NONE when this scope ends
whether on epic failure or not"

I don't know if it could have been a simpler way but at least I understand the meaning of this. Thank you !

Julien.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.