[LyX/master] Avoid potential crashes with missing document buffer in dispatch of buffer based LFUNs.

Stephan Witt switt at lyx.org
Mon Feb 17 12:18:02 UTC 2020


commit a1d68511ac6277093fe6b52f8c06f875eda52245
Author: Stephan Witt <switt at lyx.org>
Date:   Mon Feb 17 13:36:37 2020 +0100

    Avoid potential crashes with missing document buffer in dispatch of buffer based LFUNs.
    
    Use LASSERT with appropriate action instead of LATTEST assertions.
    Debug build is unchanged and asserts, release build skips the action gracefully.
---
 src/frontends/qt/GuiView.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 29f97e7..83a2593 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -4330,8 +4330,8 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 			string sdata = trim(to_utf8(cmd.argument()).substr(name.size()));
 
 			if (name == "latexlog") {
-				// gettatus checks that
-				LATTEST(doc_buffer);
+				// getStatus checks that
+				LASSERT(doc_buffer, break);
 				Buffer::LogType type;
 				string const logfile = doc_buffer->logName(&type);
 				switch (type) {
@@ -4346,7 +4346,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 				showDialog("log", sdata);
 			} else if (name == "vclog") {
 				// getStatus checks that
-				LATTEST(doc_buffer);
+				LASSERT(doc_buffer, break);
 				string const sdata2 = "vc " +
 					Lexer::quoteString(doc_buffer->lyxvc().getLogFile());
 				showDialog("log", sdata2);
@@ -4508,7 +4508,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 		case LFUN_FORWARD_SEARCH: {
 			// it seems safe to assume we have a document buffer, since
 			// getStatus wants one.
-			LATTEST(doc_buffer);
+			LASSERT(doc_buffer, break);
 			Buffer const * doc_master = doc_buffer->masterBuffer();
 			FileName const path(doc_master->temppath());
 			string const texname = doc_master->isChild(doc_buffer)


More information about the lyx-cvs mailing list