Tried at ab7ac800. At least it should be compilable with any c++ compiler.
Kornel
Now LyX can be successfully compiled with C++20 compiler. The attached
patch fixes C++20-specific deprecation warning (`this` in lambdas must
be captured explicitly), it should not affect earlier C++ versions.
Yuriy
From 2f1c206c72a6eca082f4402b8406cd028c01faf1 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Mon, 28 Dec 2020 20:59:48 +0200
Subject: [PATCH] Fix C++20 warning on implicit capture of this via [=]
---
src/frontends/qt/GuiBibtex.cpp | 2 +-
src/frontends/qt/GuiCitation.cpp | 2 +-
src/frontends/qt/GuiDocument.cpp | 2 +-
src/frontends/qt/GuiLyXFiles.cpp | 2 +-
src/frontends/qt/GuiRef.cpp | 2 +-
src/graphics/GraphicsCacheItem.cpp | 2 +-
src/insets/InsetExternal.cpp | 2 +-
src/insets/InsetInclude.cpp | 4 ++--
8 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/frontends/qt/GuiBibtex.cpp b/src/frontends/qt/GuiBibtex.cpp
index a9e0e45c55..22b704ed76 100644
--- a/src/frontends/qt/GuiBibtex.cpp
+++ b/src/frontends/qt/GuiBibtex.cpp
@@ -113,7 +113,7 @@ GuiBibtex::GuiBibtex(GuiView & lv)
availableLV, SLOT(setFocus()));
#else
connect(filter_, &FancyLineEdit::downPressed,
- availableLV, [=](){ focusAndHighlight(availableLV); });
+ availableLV, [=, this](){ focusAndHighlight(availableLV); });
#endif
availableLV->setToolTip(formatToolTip(qt_("This list consists of all
databases that are indexed by LaTeX and thus are found without a file path. "
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index b2656b132a..9ff03f30a0 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -157,7 +157,7 @@ GuiCitation::GuiCitation(GuiView & lv)
availableLV, SLOT(setFocus()));
#else
connect(filter_, &FancyLineEdit::downPressed,
- availableLV, [=](){ focusAndHighlight(availableLV); });
+ availableLV, [=, this](){ focusAndHighlight(availableLV); });
#endif
connect(regexp_, SIGNAL(triggered()),
this, SLOT(regexChanged()));
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index c21c3a00a0..4b9bdff5cc 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -1673,7 +1673,7 @@ GuiDocument::GuiDocument(GuiView & lv)
modulesModule->availableLV, SLOT(setFocus()));
#else
connect(filter_, &FancyLineEdit::downPressed,
- modulesModule->availableLV, [=](){
focusAndHighlight(modulesModule->availableLV); });
+ modulesModule->availableLV, [=, this](){
focusAndHighlight(modulesModule->availableLV); });
#endif
diff --git a/src/frontends/qt/GuiLyXFiles.cpp b/src/frontends/qt/GuiLyXFiles.cpp
index f14369a5a9..7859d4816d 100644
--- a/src/frontends/qt/GuiLyXFiles.cpp
+++ b/src/frontends/qt/GuiLyXFiles.cpp
@@ -197,7 +197,7 @@ GuiLyXFiles::GuiLyXFiles(GuiView & lv)
filesLW, SLOT(setFocus()));
#else
connect(filter_, &FancyLineEdit::downPressed,
- filesLW, [=](){ focusAndHighlight(filesLW); });
+ filesLW, [=, this](){ focusAndHighlight(filesLW); });
#endif
filterBarL->addWidget(filter_, 0);
diff --git a/src/frontends/qt/GuiRef.cpp b/src/frontends/qt/GuiRef.cpp
index 39f97eab27..6cdd7c8aaa 100644
--- a/src/frontends/qt/GuiRef.cpp
+++ b/src/frontends/qt/GuiRef.cpp
@@ -67,7 +67,7 @@ GuiRef::GuiRef(GuiView & lv)
refsTW, SLOT(setFocus()));
#else
connect(filter_, &FancyLineEdit::downPressed,
- refsTW, [=](){ focusAndHighlight(refsTW); });
+ refsTW, [=, this](){ focusAndHighlight(refsTW); });
#endif
filterBarL->addWidget(filter_, 0);
diff --git a/src/graphics/GraphicsCacheItem.cpp
b/src/graphics/GraphicsCacheItem.cpp
index 918dc02857..49132cc33b 100644
--- a/src/graphics/GraphicsCacheItem.cpp
+++ b/src/graphics/GraphicsCacheItem.cpp
@@ -220,7 +220,7 @@ void CacheItem::Impl::startMonitor()
return;
monitor_ = FileSystemWatcher::activeMonitor(filename_);
// Disconnected at the same time as this is destroyed.
- monitor_->connect([=](bool /* exists */){ startLoading(); });
+ monitor_->connect([this](bool /* exists */){ startLoading(); });
}
diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp
index 655371ee9d..42918ec81d 100644
--- a/src/insets/InsetExternal.cpp
+++ b/src/insets/InsetExternal.cpp
@@ -656,7 +656,7 @@ void InsetExternal::updatePreview() const
renderer_ = make_unique<RenderMonitoredPreview>(this);
RenderMonitoredPreview * preview_ptr =
renderer_->asMonitoredPreview();
// This connection is closed at the same time as this is
destroyed.
- preview_ptr->connect([=]() { fileChanged(); });
+ preview_ptr->connect([this]() { fileChanged(); });
add_preview_and_start_loading(*preview_ptr, *this, buffer());
break;
}
diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp
index ccee25f4ab..71e9d38d18 100644
--- a/src/insets/InsetInclude.cpp
+++ b/src/insets/InsetInclude.cpp
@@ -185,7 +185,7 @@ InsetInclude::InsetInclude(Buffer * buf, InsetCommandParams
const & p)
set_label_(false), label_(nullptr), child_buffer_(nullptr),
file_exist_(false),
recursion_error_(false)
{
- preview_->connect([=](){ fileChanged(); });
+ preview_->connect([this](){ fileChanged(); });
if (isListings(params())) {
InsetListingsParams listing_params(to_utf8(p["lstparams"]));
@@ -201,7 +201,7 @@ InsetInclude::InsetInclude(InsetInclude const & other)
set_label_(false), label_(nullptr), child_buffer_(nullptr),
file_exist_(other.file_exist_),recursion_error_(other.recursion_error_)
{
- preview_->connect([=](){ fileChanged(); });
+ preview_->connect([this](){ fileChanged(); });
if (other.label_)
label_ = new InsetLabel(*other.label_);
--
2.28.0.windows.1
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel