From baefea94e87b8a12d1b347a0ae0aca4ad16a80d6 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Wed, 5 Nov 2025 22:09:23 +0100 Subject: [PATCH] Capture this explicitly --- components/lua_ui/textedit.cpp | 2 +- components/lua_ui/widget.cpp | 12 ++++++------ components/lua_ui/window.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/lua_ui/textedit.cpp b/components/lua_ui/textedit.cpp index 359b6c6591..43f7c09cce 100644 --- a/components/lua_ui/textedit.cpp +++ b/components/lua_ui/textedit.cpp @@ -46,7 +46,7 @@ namespace LuaUi void LuaTextEdit::textChange(MyGUI::EditBox*) { - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([this](LuaUtil::LuaView& view) { triggerEvent("textChanged", sol::make_object(view.sol(), mEditBox->getCaption().asUTF8())); }); } diff --git a/components/lua_ui/widget.cpp b/components/lua_ui/widget.cpp index d00e7cc5b2..ec951f3610 100644 --- a/components/lua_ui/widget.cpp +++ b/components/lua_ui/widget.cpp @@ -367,7 +367,7 @@ namespace LuaUi void WidgetExtension::keyPress(MyGUI::Widget*, MyGUI::KeyCode code, MyGUI::Char ch) { - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([=, this](LuaUtil::LuaView& view) { if (code == MyGUI::KeyCode::None) { propagateEvent("textInput", [&](auto w) { @@ -383,21 +383,21 @@ namespace LuaUi void WidgetExtension::keyRelease(MyGUI::Widget*, MyGUI::KeyCode code) { - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([=, this](LuaUtil::LuaView& view) { propagateEvent("keyRelease", [&](auto w) { return w->keyEvent(view, code); }); }); } void WidgetExtension::mouseMove(MyGUI::Widget*, int left, int top) { - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([=, this](LuaUtil::LuaView& view) { propagateEvent("mouseMove", [&](auto w) { return w->mouseEvent(view, left, top); }); }); } void WidgetExtension::mouseDrag(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button) { - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([=, this](LuaUtil::LuaView& view) { propagateEvent("mouseMove", [&](auto w) { return w->mouseEvent(view, left, top, button); }); }); } @@ -414,14 +414,14 @@ namespace LuaUi void WidgetExtension::mousePress(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button) { - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([=, this](LuaUtil::LuaView& view) { propagateEvent("mousePress", [&](auto w) { return w->mouseEvent(view, left, top, button); }); }); } void WidgetExtension::mouseRelease(MyGUI::Widget*, int left, int top, MyGUI::MouseButton button) { - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([=, this](LuaUtil::LuaView& view) { propagateEvent("mouseRelease", [&](auto w) { return w->mouseEvent(view, left, top, button); }); }); } diff --git a/components/lua_ui/window.cpp b/components/lua_ui/window.cpp index 94d73ac2c8..ca8244394b 100644 --- a/components/lua_ui/window.cpp +++ b/components/lua_ui/window.cpp @@ -78,7 +78,7 @@ namespace LuaUi mPreviousMouse.left = left; mPreviousMouse.top = top; - protectedCall([=](LuaUtil::LuaView& view) { + protectedCall([this](LuaUtil::LuaView& view) { sol::table table = view.newTable(); table["position"] = osg::Vec2f(mCoord.left, mCoord.top); table["size"] = osg::Vec2f(mCoord.width, mCoord.height);