Cppcheck: reassignment of m_bInChangingState (dbaccess module)

julien2412 serval2412 at yahoo.fr
Wed Jun 12 13:08:48 PDT 2013


Hello,

Cppcheck reported this:
[source/core/dataaccess/documentdefinition.cxx:211] ->
[source/core/dataaccess/documentdefinition.cxx:212]: (performance,
inconclusive) Variable 'm_bInChangingState' is reassigned a value before the
old one has been used if variable is no semaphore variable
Indeed:
    207     void SAL_CALL OEmbedObjectHolder::changingState( const
lang::EventObject& /*aEvent*/, ::sal_Int32 nOldState, ::sal_Int32 nNewState
) throw (embed::WrongStateException, uno::RuntimeException)
    208     {
    209         if ( !m_bInChangingState && nNewState ==
EmbedStates::RUNNING && nOldState == EmbedStates::ACTIVE && m_pDefinition )
    210         {
    211             m_bInChangingState = true;
    212             m_bInChangingState = false;
    213         }
    214     }

see
http://opengrok.libreoffice.org/xref/core/dbaccess/source/core/dataaccess/documentdefinition.cxx#207
Is there something lacking between both (like
OEmbedObjectHolder::stateChanged function, just some lines below)?
Or should one of them be kept? Or is it a semaphre? (in this case perhaps it
could be useful to tell it in variable declaration)?

Julien



--
View this message in context: http://nabble.documentfoundation.org/Cppcheck-reassignment-of-m-bInChangingState-dbaccess-module-tp4061157.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list