[Libreoffice] Throwing exception in destructor

Stephan Bergmann stephan.bergmann.secondary at googlemail.com
Thu Aug 11 03:06:57 PDT 2011


On Aug 10, 2011, at 11:22 PM, julien2412 wrote:
> cppcheck has detected 1 Throwing exception in destructor" line 88 of
> core/bridges/test/java_uno/acquire/testacquire.cxx
> (sorry I mentionned 2 locations on IRC cause I forgot about the new git repo
> : it was in core and old ure repo)
> Could it be replaced by just a log (which function should be used for this
> kind of case ?) or something since a throw in destructor should be avoided ?

Given that assertNotNull() further down in that file uses std::abort to signal failure, the best fix probably is to use that in ~WaitCondition, too:

if (m_condition.wait() != osl::Condition::result_ok) {
    std::cerr << "osl::Condition::wait failed\n";
    std::abort()
}

-Stephan



More information about the LibreOffice mailing list