Re: [LyX/master] Add some comments to fix coverity #23386.

2016-06-14 Thread Richard Heck

On 06/14/2016 05:35 PM, Jean-Marc Lasgouttes wrote:

Le 14/06/2016 à 18:29, Richard Heck a écrit :

It's actually set by the call in createView to the GuiView constructor,
which calls setCurrentView.

Maybe we should add an assertion here?


OK, maybe coverity does not know that guiapp is the same 
GuiApplication object.


I do not know what is the right way to signal it to coverity. Maybe 
indeed adding an assertion in createView would be good.


I will add one and, for the moment, remove the coverity comment. We can 
see on next compile whether the assertion is enough to make coverity 
happy. If not, I think we can add a model for doAssert that will solve 
the problem.


Richard



Re: [LyX/master] Add some comments to fix coverity #23386.

2016-06-14 Thread Jean-Marc Lasgouttes

Le 14/06/2016 à 18:29, Richard Heck a écrit :

It's actually set by the call in createView to the GuiView constructor,
which calls setCurrentView.

Maybe we should add an assertion here?


OK, maybe coverity does not know that guiapp is the same GuiApplication 
object.


I do not know what is the right way to signal it to coverity. Maybe 
indeed adding an assertion in createView would be good.


JMarc



Re: [LyX/master] Add some comments to fix coverity #23386.

2016-06-14 Thread Richard Heck

On 06/14/2016 05:17 PM, Jean-Marc Lasgouttes wrote:

Le 12/06/2016 à 06:46, Richard Heck a écrit :

commit 1bd5ef9a754a5b521f9d067b68fdac26035ef342
Author: Richard Heck 
Date:   Sat Jun 11 23:26:02 2016 -0400

Add some comments to fix coverity #23386.

diff --git a/src/frontends/qt4/GuiApplication.cpp 
b/src/frontends/qt4/GuiApplication.cpp

index 460d7ad..022418f 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -1670,7 +1670,10 @@ void GuiApplication::dispatch(FuncRequest 
const & cmd, DispatchResult & dr)

 boost::crc_32_type crc;
 crc = for_each(fname.begin(), fname.end(), crc);
 createView(crc.checksum());
+// we know current_view_ is non-null, because createView 
sets it.


Could you explain where does createView set current_view_? I am lost 
in this function. Normally coverity is able to follow these things.


It's actually set by the call in createView to the GuiView constructor, 
which calls setCurrentView.


Maybe we should add an assertion here?

Richard



Re: [LyX/master] Add some comments to fix coverity #23386.

2016-06-14 Thread Jean-Marc Lasgouttes

Le 12/06/2016 à 06:46, Richard Heck a écrit :

commit 1bd5ef9a754a5b521f9d067b68fdac26035ef342
Author: Richard Heck 
Date:   Sat Jun 11 23:26:02 2016 -0400

Add some comments to fix coverity #23386.

diff --git a/src/frontends/qt4/GuiApplication.cpp 
b/src/frontends/qt4/GuiApplication.cpp
index 460d7ad..022418f 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -1670,7 +1670,10 @@ void GuiApplication::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
boost::crc_32_type crc;
crc = for_each(fname.begin(), fname.end(), crc);
createView(crc.checksum());
+   // we know current_view_ is non-null, because 
createView sets it.


Could you explain where does createView set current_view_? I am lost in 
this function. Normally coverity is able to follow these things.


JMarc


+   // coverity[FORWARD_NULL]
current_view_->openDocument(fname);
+   // FIXME but then why check current_view_ here?
if (current_view_ && 
!current_view_->documentBufferView())
current_view_->close();
} else {