Here are new defaults discovered by coverity. Guillaume, I think that they should all ring bells wrt your recent external modification code.

JMarc


-------- Message transféré --------
Sujet : New Defects reported by Coverity Scan for LyX
Date : Mon, 13 Mar 2017 09:50:13 -0700
De : scan-ad...@coverity.com
Pour : lasgout...@lyx.org


Hi,

Please find the latest report on new defect(s) introduced to LyX found with Coverity Scan.

7 new defect(s) introduced to LyX found with Coverity Scan.
2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 7 of 7 defect(s)


** CID 142309:  Incorrect expression  (USELESS_CALL)


________________________________________________________________________________________________________
*** CID 142309:  Incorrect expression  (USELESS_CALL)
/src/frontends/qt4/GuiView.cpp: 3738 in lyx::frontend::GuiView::dispatch(const lyx::FuncRequest &, lyx::DispatchResult &)()
3732                            LASSERT(doc_buffer, break);
3733     3734                           int ret = 0;
3735                            if (!doc_buffer->isClean()) {
3736                                    docstring const file =
3737                                            
makeDisplayPath(doc_buffer->absFileName(), 20);
    CID 142309:  Incorrect expression  (USELESS_CALL)
    Calling "doc_buffer->notifiesExternalModification()" is only useful for its 
return value, which is ignored.
3738                                    
doc_buffer->notifiesExternalModification();
3739                                    docstring text = 
doc_buffer->notifiesExternalModification() ?
3740                                              _("Any changes will be lost. "
3741                                                "Are you sure you want to load 
the version on disk "
3742                                                "of the document %1$s?")
3743                                            : _("Any changes will be lost. "

** CID 142308:  Incorrect expression  (IDENTICAL_BRANCHES)
/src/support/moc_FileMonitor.cpp: 166 in lyx::support::FileMonitorBlockerGuard::qt_metacall(QMetaObject::Call, int, void **)()


________________________________________________________________________________________________________
*** CID 142308:  Incorrect expression  (IDENTICAL_BRANCHES)
/src/support/moc_FileMonitor.cpp: 166 in lyx::support::FileMonitorBlockerGuard::qt_metacall(QMetaObject::Call, int, void **)()
160         return QObject::qt_metacast(_clname);
161     }
162 163 int lyx::support::FileMonitorBlockerGuard::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
164     {
165         _id = QObject::qt_metacall(_c, _id, _a);
    CID 142308:  Incorrect expression  (IDENTICAL_BRANCHES)
    The same code is executed when the condition "_id < 0" is true or false, 
because the code in the if-then branch and after the if statement is identical. Should the 
if statement be removed?
166         if (_id < 0)
167             return _id;
168         return _id;
169     }
170     static const uint qt_meta_data_lyx__support__FileMonitor[] = {
171
** CID 142307:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 1691 in lyx::frontend::TabWorkArea::currentWorkArea()()


________________________________________________________________________________________________________
*** CID 142307:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 1691 in lyx::frontend::TabWorkArea::currentWorkArea()()
1685     1686     GuiWorkArea * TabWorkArea::currentWorkArea()
1687     {
1688            if (count() == 0)
1689                    return 0;
1690     >>>     CID 142307:  Null pointer dereferences  (FORWARD_NULL)
    Assigning: "wac" = "dynamic_cast <lyx::frontend::GuiWorkAreaContainer 
*>(this->currentWidget())".
1691            GuiWorkAreaContainer * wac =
1692                    dynamic_cast<GuiWorkAreaContainer *>(currentWidget());
1693            LATTEST(wac);
1694            GuiWorkArea * wa = wac->workArea();
1695            LATTEST(wa);
1696            return wa;

** CID 142306:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 1708 in lyx::frontend::TabWorkArea::workArea(int)()


________________________________________________________________________________________________________
*** CID 142306:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 1708 in lyx::frontend::TabWorkArea::workArea(int)() 1702 return (dynamic_cast<GuiWorkAreaContainer *>(widget(index)))->workArea();
1703     }
1704     1705     1706     GuiWorkArea * TabWorkArea::workArea(int index)
1707     {
    CID 142306:  Null pointer dereferences  (FORWARD_NULL)
    Dynamic cast to pointer "dynamic_cast <lyx::frontend::GuiWorkAreaContainer 
*>(this->widget(index))" can return "NULL".
1708 return (dynamic_cast<GuiWorkAreaContainer *>(widget(index)))->workArea();
1709     }
1710 1711 1712 GuiWorkArea * TabWorkArea::workArea(Buffer & buffer)
1713     {

** CID 142305:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 2223 in lyx::frontend::GuiWorkAreaContainer::updateDisplay()()


________________________________________________________________________________________________________
*** CID 142305:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 2223 in lyx::frontend::GuiWorkAreaContainer::updateDisplay()()
2217            updateDisplay();
2218     }
2219     2220     2221     void GuiWorkAreaContainer::updateDisplay()
2222     {
    CID 142305:  Null pointer dereferences  (FORWARD_NULL)
    Comparing "this->wa_" to null implies that "this->wa_" might be null.
2223            if (!wa_)
2224                    notificationFrame->hide();
2225     2226           Buffer const & buf = wa_->bufferView().buffer();
2227            
notificationFrame->setHidden(!buf.notifiesExternalModification());
2228 QString const label = QString("<b>The file \"%1\" changed on disk.</b>")

** CID 142304:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 1702 in lyx::frontend::TabWorkArea::workArea(int) const()


________________________________________________________________________________________________________
*** CID 142304:  Null pointer dereferences  (FORWARD_NULL)
/src/frontends/qt4/GuiWorkArea.cpp: 1702 in lyx::frontend::TabWorkArea::workArea(int) const()
1696            return wa;
1697     }
1698 1699 1700 GuiWorkArea const * TabWorkArea::workArea(int index) const
1701     {
    CID 142304:  Null pointer dereferences  (FORWARD_NULL)
    Dynamic cast to pointer "dynamic_cast <lyx::frontend::GuiWorkAreaContainer 
*>(this->widget(index))" can return "NULL".
1702 return (dynamic_cast<GuiWorkAreaContainer *>(widget(index)))->workArea();
1703     }
1704     1705     1706     GuiWorkArea * TabWorkArea::workArea(int index)
1707     {

** CID 142303:  Incorrect expression  (CONSTANT_EXPRESSION_RESULT)
/usr/include/boost/function/function_template.hpp: 911 in boost::function0<void>::assign_to<lyx::InsetInclude::InsetInclude(lyx::Buffer *, const lyx::InsetCommandParams &)::[lambda() (instance 1)]>(T1)()


________________________________________________________________________________________________________
*** CID 142303:  Incorrect expression  (CONSTANT_EXPRESSION_RESULT)
/usr/include/boost/function/function_template.hpp: 911 in boost::function0<void>::assign_to<lyx::InsetInclude::InsetInclude(lyx::Buffer *, const lyx::InsetCommandParams &)::[lambda() (instance 1)]>(T1)() 905 // https://u2389337.ct.sendgrid.net/wf/click?upn=plGdX9ryUdzQMWicX-2FWFAFUGTaQPzPFhMK1qVXCBmJbnRlVRzZDBsAUxLdNqS-2Ff7Sp7dEu9UUNeySttoY-2FdKoY0yY-2FWDXoyzgwf0n8WiHHQ-3D_FocuuqQsn-2FnlHMnVngCR8l20EiTVA3caADQAvE03ez-2BwMhl4ZQbLqUlwjFmRCZJ6ZQbKkuwLMIwt9Y7KNvsuwe-2Fw7BXOrs0OxeUt8PsshfeW-2Bpd2TMJsoLgM40ijdxZ8hdKzLH1v-2FV1WqFuG1QzheagRB8mXK60HfQaiqKh105gQCWmgLWtT-2FAtYPZYdpUwcEvZPWhsLbxm-2F5Np2cuFFRg-3D-3D 906 static const vtable_type stored_vtable = 907 { { &manager_type::manage }, &invoker_type::invoke };
908     909           if (stored_vtable.assign_to(f, functor)) {
910 std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
    CID 142303:  Incorrect expression  (CONSTANT_EXPRESSION_RESULT)
    The expression "true /* mpl_::bool_<true>::value */ && true /* mpl_::bool_<true>::value */" 
does not accomplish anything because it evaluates to either of its identical operands, 
"mpl_::bool_<true>::value".
911             if (boost::has_trivial_copy_constructor<Functor>::value &&
912                 boost::has_trivial_destructor<Functor>::value &&
913 detail::function::function_allows_small_object_optimization<Functor>::value)
914               value |= static_cast<size_t>(0x01);
915 vtable = reinterpret_cast<detail::function::vtable_base *>(value);
916           } else

________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRYADu2lXp-2FMPbCudg6BDTp-2BMtFyh50OjtqMFhpTPmF7HQ-3D-3D_FocuuqQsn-2FnlHMnVngCR8l20EiTVA3caADQAvE03ez-2BwMhl4ZQbLqUlwjFmRCZJ6pvfEpm18ZWL9zZ0Brw7bAQ07qE-2FK3DJYXu9NBzi4FXkfM3BcpRM-2F2C9NE082uOCXnQFknaWKCJkbYW0fVRUyjkBbYSvFbSkU1TInX4r95osqvHu6GVkbdjdTo7M0P9oxHKOEbqglW-2FIfCG4ZQTw1Ng-3D-3D

To manage Coverity Scan email notifications for "lasgout...@lyx.org", click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4zTHc7nwJZRA7xlxvk-2BHHUjYobniXPUx6JtikOAvgrJOKMB21XuO3WOMg3ALkUD3viwARC-2BQUxsd4CpiVuVeaaCzATWk06pn7unQQf2F1jn4-3D_FocuuqQsn-2FnlHMnVngCR8l20EiTVA3caADQAvE03ez-2BwMhl4ZQbLqUlwjFmRCZJ6-2FtdlelXQjq8nqQnuTYtBAfHRyGRAJcN65O-2FORhDVRnm8xbw-2Fyv2NY4ArdmbIYX0tIyFy80SwEX-2BT7SeiXuJBUlCxSAbP5-2FThJNtB68DYqjZluVj65lk5fv1NDcqZE-2F35x0mZYkKT1k-2BdxLIXe6OU6g-3D-3D

Reply via email to