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.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to