As for the patch 5, these null pointer dereferences happen even on
opening LyX manuals. It is undefined behavior even if it doesn't crash
LyX. Most likely should be fixed somewhere instead of just checking.
Yuriy
From 761602ef70c60403992255ac2e3c23b112235378 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Mon, 23 Nov 2020 00:23:39 +0200
Subject: [PATCH 1/5] Cleanup headers
---
src/LaTeXFeatures.cpp | 1 +
src/LaTeXFeatures.h | 4 +++-
src/Layout.h | 1 -
src/LyX.cpp | 1 -
src/frontends/Clipboard.h | 3 ++-
src/frontends/qt/GuiBox.h | 1 -
src/frontends/qt/GuiChanges.cpp | 5 -----
src/frontends/qt/GuiChanges.h | 3 ---
src/frontends/qt/GuiCharacter.cpp | 1 -
src/frontends/qt/GuiCounter.cpp | 2 ++
src/frontends/qt/GuiCounter.h | 3 ++-
src/insets/InsetCommand.cpp | 1 -
src/insets/InsetCommandParams.h | 5 ++---
src/insets/InsetERT.cpp | 6 ------
src/insets/InsetHyperlink.cpp | 3 +--
src/insets/InsetPreview.cpp | 1 +
src/insets/InsetPreview.h | 3 +--
src/insets/InsetText.cpp | 1 -
src/mathed/InsetMathXArrow.cpp | 4 ++--
src/mathed/MathData.cpp | 1 +
src/mathed/MathData.h | 3 +--
src/mathed/MathRow.h | 1 -
src/mathed/MathStream.cpp | 2 ++
src/mathed/MathStream.h | 1 -
src/output_docbook.cpp | 1 +
src/support/lyxmagic.h | 4 ++--
src/tests/check_layout.cpp | 1 +
src/tex2lyx/Parser.cpp | 3 ++-
src/tex2lyx/Preamble.cpp | 1 -
src/tex2lyx/tex2lyx.cpp | 1 +
src/xml.cpp | 1 +
31 files changed, 29 insertions(+), 40 deletions(-)
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 4c3d817a54..b9652d9ac7 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -28,6 +28,7 @@
#include "LaTeXPackages.h"
#include "Layout.h"
#include "LyXRC.h"
+#include "OutputParams.h"
#include "TextClass.h"
#include "TexRow.h"
#include "texstream.h"
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index c8cc7c285c..e87916244b 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -13,12 +13,12 @@
#ifndef LATEXFEATURES_H
#define LATEXFEATURES_H
-#include "OutputParams.h"
#include "support/strfwd.h"
#include <set>
#include <list>
#include <map>
+#include <vector>
namespace lyx {
@@ -27,6 +27,8 @@ class Buffer;
class BufferParams;
class InsetLayout;
class Language;
+class otexstream;
+class OutputParams;
struct TexString;
/** The packages and commands that a buffer needs. This class
diff --git a/src/Layout.h b/src/Layout.h
index cb8f537cbb..2e1685d896 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -17,7 +17,6 @@
#include "FontInfo.h"
#include "LayoutEnums.h"
#include "Spacing.h"
-#include "support/debug.h"
#include "support/docstring.h"
#include <map>
diff --git a/src/LyX.cpp b/src/LyX.cpp
index c1369bcde7..44361baa0f 100644
--- a/src/LyX.cpp
+++ b/src/LyX.cpp
@@ -38,7 +38,6 @@
#include "Language.h"
#include "LaTeXFonts.h"
#include "LayoutFile.h"
-#include "LyX.h"
#include "LyXAction.h"
#include "LyXRC.h"
#include "ModuleList.h"
diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h
index 21fd58227e..c06a17f50b 100644
--- a/src/frontends/Clipboard.h
+++ b/src/frontends/Clipboard.h
@@ -14,13 +14,14 @@
#ifndef BASE_CLIPBOARD_H
#define BASE_CLIPBOARD_H
-#include "support/FileName.h"
#include "support/strfwd.h"
namespace lyx {
class Cursor;
+namespace support { class FileName; }
+
namespace frontend {
/**
diff --git a/src/frontends/qt/GuiBox.h b/src/frontends/qt/GuiBox.h
index 67630bb9a0..1df2074a5e 100644
--- a/src/frontends/qt/GuiBox.h
+++ b/src/frontends/qt/GuiBox.h
@@ -15,7 +15,6 @@
#include "InsetParamsWidget.h"
#include "ui_BoxUi.h"
-#include "Font.h"
namespace lyx {
namespace frontend {
diff --git a/src/frontends/qt/GuiChanges.cpp b/src/frontends/qt/GuiChanges.cpp
index c1f331feda..e6363cd6be 100644
--- a/src/frontends/qt/GuiChanges.cpp
+++ b/src/frontends/qt/GuiChanges.cpp
@@ -15,10 +15,6 @@
#include "qt_helpers.h"
-#include "support/gettext.h"
-#include "support/lstrings.h"
-#include "support/lyxtime.h"
-
#include "Author.h"
#include "Buffer.h"
#include "BufferParams.h"
@@ -27,7 +23,6 @@
#include "Cursor.h"
#include "FuncRequest.h"
#include "LyXRC.h"
-#include "Text.h"
#include <QDateTime>
#include <QTextBrowser>
diff --git a/src/frontends/qt/GuiChanges.h b/src/frontends/qt/GuiChanges.h
index fce6150e34..339a3eefd4 100644
--- a/src/frontends/qt/GuiChanges.h
+++ b/src/frontends/qt/GuiChanges.h
@@ -16,9 +16,6 @@
#include "GuiDialog.h"
#include "ui_ChangesUi.h"
-#include "support/debug.h"
-#include "support/docstring.h"
-
namespace lyx {
namespace frontend {
diff --git a/src/frontends/qt/GuiCharacter.cpp
b/src/frontends/qt/GuiCharacter.cpp
index cfa481c832..b6b672c69a 100644
--- a/src/frontends/qt/GuiCharacter.cpp
+++ b/src/frontends/qt/GuiCharacter.cpp
@@ -30,7 +30,6 @@
#include "Paragraph.h"
#include "support/gettext.h"
-#include "support/lstrings.h"
#include <QAbstractItemModel>
#include <QPushButton>
diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index d7685bc7bb..1c79725a87 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -12,6 +12,7 @@
#include "GuiCounter.h"
+#include "GuiView.h"
#include "qt_helpers.h"
#include "Buffer.h"
@@ -22,6 +23,7 @@
#include "insets/InsetCommandParams.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/gettext.h"
#include "support/lstrings.h"
diff --git a/src/frontends/qt/GuiCounter.h b/src/frontends/qt/GuiCounter.h
index d512a8b06e..3ca95333d4 100644
--- a/src/frontends/qt/GuiCounter.h
+++ b/src/frontends/qt/GuiCounter.h
@@ -14,13 +14,14 @@
#include "InsetParamsWidget.h"
#include "ui_CounterUi.h"
-#include "GuiView.h"
namespace lyx {
class InsetCommandParams;
namespace frontend {
+class GuiView;
+
class GuiCounter : public InsetParamsWidget, public Ui::CounterUi
{
Q_OBJECT
diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp
index 3abddca6a2..ca3b51d372 100644
--- a/src/insets/InsetCommand.cpp
+++ b/src/insets/InsetCommand.cpp
@@ -44,7 +44,6 @@
#include "insets/InsetWrap.h"
#include "support/debug.h"
-#include "support/gettext.h"
#include "support/lstrings.h"
#include "frontends/Application.h"
diff --git a/src/insets/InsetCommandParams.h b/src/insets/InsetCommandParams.h
index 874a9a53db..3e33054d48 100644
--- a/src/insets/InsetCommandParams.h
+++ b/src/insets/InsetCommandParams.h
@@ -16,8 +16,6 @@
#include "InsetCode.h"
-#include "OutputParams.h"
-
#include "support/docstring.h"
#include <string>
@@ -27,8 +25,9 @@
namespace lyx {
-class Lexer;
class Buffer;
+class Lexer;
+class OutputParams;
class ParamInfo {
public:
diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp
index 453501403c..c9b266df22 100644
--- a/src/insets/InsetERT.cpp
+++ b/src/insets/InsetERT.cpp
@@ -13,17 +13,11 @@
#include "InsetERT.h"
-#include "Buffer.h"
-#include "BufferParams.h"
-#include "BufferView.h"
#include "Cursor.h"
-#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "Language.h"
-#include "Layout.h"
#include "Lexer.h"
-#include "LyXAction.h"
#include "OutputParams.h"
#include "xml.h"
#include "ParagraphParameters.h"
diff --git a/src/insets/InsetHyperlink.cpp b/src/insets/InsetHyperlink.cpp
index 7562978ace..559150c333 100644
--- a/src/insets/InsetHyperlink.cpp
+++ b/src/insets/InsetHyperlink.cpp
@@ -13,8 +13,6 @@
#include "InsetHyperlink.h"
#include "Buffer.h"
-#include "DispatchResult.h"
-#include "Encoding.h"
#include "Format.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
@@ -25,6 +23,7 @@
#include "xml.h"
#include "texstream.h"
+#include "support/debug.h"
#include "support/docstream.h"
#include "support/FileName.h"
#include "support/filetools.h"
diff --git a/src/insets/InsetPreview.cpp b/src/insets/InsetPreview.cpp
index 1a70b1e17a..ba4a69d33d 100644
--- a/src/insets/InsetPreview.cpp
+++ b/src/insets/InsetPreview.cpp
@@ -15,6 +15,7 @@
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
+#include "Dimension.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
diff --git a/src/insets/InsetPreview.h b/src/insets/InsetPreview.h
index 834d892e23..91c579ad37 100644
--- a/src/insets/InsetPreview.h
+++ b/src/insets/InsetPreview.h
@@ -14,13 +14,12 @@
#include "InsetText.h"
-#include "Dimension.h"
-
#include "support/unique_ptr.h"
namespace lyx {
+class Dimension;
class RenderPreview;
namespace graphics {
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index b05024f426..25971532be 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -44,7 +44,6 @@
#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "ParIterator.h"
-#include "Row.h"
#include "TexRow.h"
#include "texstream.h"
#include "TextClass.h"
diff --git a/src/mathed/InsetMathXArrow.cpp b/src/mathed/InsetMathXArrow.cpp
index cdf3fbf175..f4bd7e18cb 100644
--- a/src/mathed/InsetMathXArrow.cpp
+++ b/src/mathed/InsetMathXArrow.cpp
@@ -10,8 +10,6 @@
#include <config.h>
-#include "support/lassert.h"
-
#include "InsetMathXArrow.h"
#include "MathData.h"
@@ -21,6 +19,8 @@
#include "LaTeXFeatures.h"
#include "MetricsInfo.h"
+#include "support/debug.h"
+#include "support/lassert.h"
#include <algorithm>
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index 50fc100e64..610a3e20eb 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -27,6 +27,7 @@
#include "BufferView.h"
#include "CoordCache.h"
#include "Cursor.h"
+#include "Dimension.h"
#include "mathed/InsetMathUnknown.h"
diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h
index 81d6cfcd78..c27b9f58d6 100644
--- a/src/mathed/MathData.h
+++ b/src/mathed/MathData.h
@@ -15,8 +15,6 @@
#ifndef MATH_DATA_H
#define MATH_DATA_H
-#include "Dimension.h"
-
#include "MathAtom.h"
#include "MathRow.h"
@@ -33,6 +31,7 @@ namespace lyx {
class Buffer;
class BufferView;
class Cursor;
+class Dimension;
class DocIterator;
class LaTeXFeatures;
class ReplaceData;
diff --git a/src/mathed/MathRow.h b/src/mathed/MathRow.h
index d985569f46..6d929ca947 100644
--- a/src/mathed/MathRow.h
+++ b/src/mathed/MathRow.h
@@ -25,7 +25,6 @@
namespace lyx {
class BufferView;
-class Dimension;
class MathData;
class MetricsInfo;
class PainterInfo;
diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp
index 588e219157..9c2d5cef8c 100644
--- a/src/mathed/MathStream.cpp
+++ b/src/mathed/MathStream.cpp
@@ -18,6 +18,8 @@
#include "TexRow.h"
+
+#include "support/debug.h"
#include "support/docstring.h"
#include "support/textutils.h"
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index 94e810de83..a75a4cd907 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -19,7 +19,6 @@
#include "support/Changer.h"
#include "support/strfwd.h"
-#include "support/unique_ptr.h"
namespace lyx {
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 6baded4995..fccc570920 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -31,6 +31,7 @@
#include "mathed/InsetMath.h"
#include "insets/InsetNote.h"
+#include "support/debug.h"
#include "support/lassert.h"
#include "support/textutils.h"
diff --git a/src/support/lyxmagic.h b/src/support/lyxmagic.h
index 9a40d6f1f9..d58aed850a 100644
--- a/src/support/lyxmagic.h
+++ b/src/support/lyxmagic.h
@@ -12,12 +12,12 @@
#ifndef LYX_MAGIC_H
#define LYX_MAGIC_H
+#include "support/debug.h"
+
namespace lyx {
#ifdef HAVE_MAGIC_H
-#include "support/debug.h"
-
#include <magic.h>
class Magic {
diff --git a/src/tests/check_layout.cpp b/src/tests/check_layout.cpp
index 039d51b222..afdb66777d 100644
--- a/src/tests/check_layout.cpp
+++ b/src/tests/check_layout.cpp
@@ -1,5 +1,6 @@
#include <config.h>
+#include "../support/debug.h"
#include "../support/FileName.h"
#include "../support/filetools.h"
#include "../Format.h"
diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp
index 795628bddf..ee25db246d 100644
--- a/src/tex2lyx/Parser.cpp
+++ b/src/tex2lyx/Parser.cpp
@@ -10,8 +10,9 @@
#include <config.h>
-#include "Encoding.h"
#include "Parser.h"
+
+#include "Encoding.h"
#include "support/lstrings.h"
#include "support/textutils.h"
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index f7303b6404..d6deccb90c 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -18,7 +18,6 @@
#include "Encoding.h"
#include "LayoutFile.h"
-#include "Layout.h"
#include "Lexer.h"
#include "TextClass.h"
#include "version.h"
diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index 8ecfa68374..810567c716 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -26,6 +26,7 @@
#include "support/ConsoleApplication.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/ExceptionMessage.h"
#include "support/filetools.h"
#include "support/lassert.h"
diff --git a/src/xml.cpp b/src/xml.cpp
index 4c4629f4bf..e479eadeec 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -23,6 +23,7 @@
#include "TextClass.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/docstream.h"
#include "support/lassert.h"
#include "support/lstrings.h"
--
2.28.0.windows.1
From db3dfda2ccdbd35b9a41965e4ec962175820cb5e Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Tue, 24 Nov 2020 19:58:24 +0200
Subject: [PATCH 2/5] Fix memory leak
---
src/frontends/qt/GuiAbout.cpp | 6 ++++++
src/frontends/qt/GuiAbout.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/src/frontends/qt/GuiAbout.cpp b/src/frontends/qt/GuiAbout.cpp
index f3e58e2fb4..a76b087d87 100644
--- a/src/frontends/qt/GuiAbout.cpp
+++ b/src/frontends/qt/GuiAbout.cpp
@@ -343,6 +343,12 @@ GuiAbout::GuiAbout(GuiView & lv)
}
+GuiAbout::~GuiAbout()
+{
+ delete d;
+}
+
+
void GuiAbout::on_buttonBox_rejected()
{
close();
diff --git a/src/frontends/qt/GuiAbout.h b/src/frontends/qt/GuiAbout.h
index 3fa8d5b4c8..c9b2443689 100644
--- a/src/frontends/qt/GuiAbout.h
+++ b/src/frontends/qt/GuiAbout.h
@@ -24,6 +24,7 @@ class GuiAbout : public DialogView
public:
// Constructor
GuiAbout(GuiView & lv);
+ ~GuiAbout();
private Q_SLOTS:
void on_buttonBox_rejected();
--
2.28.0.windows.1
From 94f96e1660c63e1769c815495dbc096f0fef9657 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Tue, 24 Nov 2020 20:46:49 +0200
Subject: [PATCH 3/5] Add default TransformID enum value
---
src/insets/ExternalTemplate.cpp | 2 +-
src/insets/ExternalTransforms.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/insets/ExternalTemplate.cpp b/src/insets/ExternalTemplate.cpp
index 02f4e875a5..e7eca8b274 100644
--- a/src/insets/ExternalTemplate.cpp
+++ b/src/insets/ExternalTemplate.cpp
@@ -36,7 +36,7 @@ typedef Translator<TransformID, string> TransformIDTranslator;
static TransformIDTranslator const initIDTranslator()
{
- TransformIDTranslator translator(TransformID(-1), "");
+ TransformIDTranslator translator(None, "");
translator.addPair(Rotate, "Rotate");
translator.addPair(Resize, "Resize");
translator.addPair(Clip, "Clip");
diff --git a/src/insets/ExternalTransforms.h b/src/insets/ExternalTransforms.h
index 62e3342352..2311ac2f66 100644
--- a/src/insets/ExternalTransforms.h
+++ b/src/insets/ExternalTransforms.h
@@ -307,6 +307,7 @@ std::string const sanitizeDocBookOption(std::string const &
input);
enum TransformID {
+ None = -1,
Rotate,
Resize,
Clip,
--
2.28.0.windows.1
From 0a263aab265ca8bff623bba49e93fc06ecff44e8 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Tue, 24 Nov 2020 22:42:06 +0200
Subject: [PATCH 4/5] Simplify InsetQuotes constructors
---
src/insets/InsetQuotes.cpp | 13 ++-----------
src/insets/InsetQuotes.h | 16 ++++++++--------
2 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp
index 0acdcf112b..ec5c3727e6 100644
--- a/src/insets/InsetQuotes.cpp
+++ b/src/insets/InsetQuotes.cpp
@@ -614,18 +614,12 @@ docstring const
InsetQuotesParams::getShortGuiLabel(docstring const & str) const
///////////////////////////////////////////////////////////////////////
InsetQuotes::InsetQuotes(Buffer * buf, string const & str)
- : Inset(buf),
- style_(InsetQuotesParams::EnglishQuotes),
side_(InsetQuotesParams::OpeningQuote),
- pass_thru_(false), internal_fontenc_(false), rtl_(false)
+ : Inset(buf)
{
if (buf) {
global_style_ = buf->masterBuffer()->params().quotes_style;
fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
}
- else {
- global_style_ = InsetQuotesParams::EnglishQuotes;
- fontspec_ = false;
- }
parseString(str);
}
@@ -633,8 +627,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, string const & str)
InsetQuotes::InsetQuotes(Buffer * buf, char_type c,
InsetQuotesParams::QuoteLevel level,
string const & side, string const & style)
- : Inset(buf), level_(level), pass_thru_(false), fontspec_(false),
- internal_fontenc_(false), rtl_(false)
+ : Inset(buf), level_(level)
{
bool dynamic = false;
if (buf) {
@@ -643,9 +636,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c,
InsetQuotesParams::QuoteLeve
dynamic = buf->masterBuffer()->params().dynamic_quotes;
fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
} else {
- global_style_ = InsetQuotesParams::EnglishQuotes;
fontenc_ = "OT1";
- fontspec_ = false;
}
if (style.empty())
style_ = dynamic ? InsetQuotesParams::DynamicQuotes :
global_style_;
diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h
index bda11becf3..17027f6319 100644
--- a/src/insets/InsetQuotes.h
+++ b/src/insets/InsetQuotes.h
@@ -187,25 +187,25 @@ private:
InsetQuotesParams::QuoteStyle getStyle(std::string const &);
///
- InsetQuotesParams::QuoteStyle style_;
+ InsetQuotesParams::QuoteStyle style_ = InsetQuotesParams::EnglishQuotes;
///
- InsetQuotesParams::QuoteSide side_;
+ InsetQuotesParams::QuoteSide side_ = InsetQuotesParams::OpeningQuote;
///
- InsetQuotesParams::QuoteLevel level_;
+ InsetQuotesParams::QuoteLevel level_ = InsetQuotesParams::PrimaryQuotes;
///
- InsetQuotesParams::QuoteStyle global_style_;
+ InsetQuotesParams::QuoteStyle global_style_ =
InsetQuotesParams::EnglishQuotes;
/// Current font encoding
std::string fontenc_;
/// Code of the contextual language
std::string context_lang_;
/// Is this in a pass-thru context?
- bool pass_thru_;
+ bool pass_thru_ = false;
/// Do we use fontspec?
- bool fontspec_;
+ bool fontspec_ = false;
/// Do we have an internal font encoding?
- bool internal_fontenc_;
+ bool internal_fontenc_ = false;
/// Are we writing RTL?
- bool rtl_;
+ bool rtl_ = false;
///
friend class InsetQuotesParams;
--
2.28.0.windows.1
From 234bfe70c1e2766d856257aebe7eaad8836f5976 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Tue, 24 Nov 2020 22:59:24 +0200
Subject: [PATCH 5/5] Add nullptr checks
---
src/mathed/InsetMathMacro.cpp | 2 ++
src/mathed/InsetMathNest.cpp | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index 881a3c8194..bc9ee9d318 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -307,6 +307,8 @@ InsetMathMacro::InsetMathMacro(Buffer * buf, docstring
const & name)
InsetMathMacro::InsetMathMacro(InsetMathMacro const & that)
: InsetMathNest(that), d(new Private(*that.d))
{
+ if (!that.buffer_)
+ LYXERR0("Passing nullptr as reference");
setBuffer(*that.buffer_);
d->updateChildren(this);
}
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index c085439017..2c5f6b35a0 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -85,6 +85,8 @@ using cap::selClearOrDel;
InsetMathNest::InsetMathNest(Buffer * buf, idx_type nargs)
: InsetMath(buf), cells_(nargs), lock_(false)
{
+ if (!buf)
+ LYXERR0("Passing nullptr as reference");
setBuffer(*buf);
}
--
2.28.0.windows.1
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel