[Libreoffice] [Patch] Cppcheck cleaning on dbaccess

Julien Nabet serval2412 at yahoo.fr
Fri Jan 14 15:03:51 PST 2011


Hello,

Here is a small patch for  Cppcheck cleaning on dbaccess

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 :
m_eDoingCurrently = SETTING_PROPERTIES; <- OK why not
OAutoActionReset(this); <- the constructor followed directly by the 
destructor since the object is not used at all
m_xCommandDefinition->setPropertyValue(sAggPropName, _rValue);

in query.hxx
     // 
------------------------------------------------------------------------
     /** a class which automatically resets m_eDoingCurrently in it's 
destructor
     */
     class OAutoActionReset;     // just for the following friend 
declaration
     friend class OAutoActionReset;
     class OAutoActionReset
     {
         OQuery*                         m_pActor;
     public:
         OAutoActionReset(OQuery* _pActor) : m_pActor(_pActor) { }
         ~OAutoActionReset() { m_pActor->m_eDoingCurrently = NONE; }
     };
And i saw that m_eDoingCurrently wasn't used after in query.cxx
Could someone explain the meaning of all this ?
By the way, we can see the same kind of thing in api/querycontainer.cxx 
(line 193)

(LGPLv3+ / MPL)

Julien
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: commit-d0aa16b
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110115/d27b05b4/attachment.asc>


More information about the LibreOffice mailing list