Fix warning with lambda captuer while compiling Gui01 tutorial.

This commit is contained in:
Zbigniew Rębacz 2025-07-05 13:19:12 +02:00
parent 8d25d929d5
commit e909742efd
11 changed files with 16 additions and 15 deletions

View file

@ -183,7 +183,7 @@ class AsyncWork {
Ret2 ret;
template<class Function, class... Args>
void Do(Function&& f, Args&&... args) { co.Do([=]() { ret = f(args...); }); }
void Do(Function&& f, Args&&... args) { co.Do([=, this]() { ret = f(args...); }); }
const Ret2& Get() { return ret; }
Ret2 Pick() { return pick(ret); }
};

View file

@ -36,7 +36,7 @@ public:
void Set(Stream& in_, F& filter) {
Init();
in = &in_;
filter.WhenOut = [=](const void *ptr, int size) { Out(ptr, size); };
filter.WhenOut = [this](const void *ptr, int size) { Out(ptr, size); };
Filter = [&filter](const void *ptr, int size) { filter.Put(ptr, size); };
End = [&filter] { filter.End(); };
}

View file

@ -71,7 +71,7 @@ public:
Function(Function&& src) { Pick(pick(src)); }
Function& operator=(Function&& src) { if(&src != this) { Free(ptr); ptr = src.ptr; src.ptr = NULL; } return *this; }
Function Proxy() const { return [=] (ArgTypes... args) { return (*this)(args...); }; }
Function Proxy() const { return [this] (ArgTypes... args) { return (*this)(args...); }; }
template <class F>
Function& operator<<(F fn) { if(!ptr) { Pick(pick(fn)); return *this; }

View file

@ -435,7 +435,7 @@ ColorPopUp::ColorPopUp()
voidtext = t_("(none)");
settext.SetImage(CtrlImg::color_edit());
settext << [=] {
settext << [this] {
String text;
if(!IsNull(color) && color != VoidColor())
text = ColorToHtml(color);

View file

@ -402,11 +402,12 @@ void MemoryProfileInfo() {
};
FileSelButton::FileSelButton(MODE mode, const char *title)
: title(title), mode(mode)
: title(title)
, mode(mode)
{
button.NoWantFocus();
button.SetImage(mode == MODE_DIR ? CtrlImg::DirSmall() : CtrlImg::FileSmall());
button << [=] { OnAction(); };
button << [this] { OnAction(); };
}
void FileSelButton::Attach(Ctrl& parent)

View file

@ -513,7 +513,7 @@ public:
cc.clock <<= THISBACK(OnClockChoice);
cc.WhenPopDown = THISBACK(OnClose);
cc.calendar.WhenSelect = WhenSelect.Proxy();
this->WhenPaper = [=](Color c) {
this->WhenPaper = [this](Color c) {
drop.SetPaper(c);
};
}

View file

@ -6,7 +6,7 @@ DropChoice::DropChoice() {
always_drop = hide_drop = false;
AddButton().Main() <<= THISBACK(Drop);
NoDisplay();
list.WhenSelect = [=] { Select(); };
list.WhenSelect = [this] { Select(); };
dropfocus = true;
EnableDrop(false);
dropwidth = 0;
@ -21,7 +21,7 @@ void DropChoice::AddTo(Ctrl& _owner)
owner = &_owner;
if(auto *ef = dynamic_cast<EditField *>(owner))
ef->WhenPaper = [=](Color c) { MultiButtonFrame::SetPaper(c); };
ef->WhenPaper = [this](Color c) { MultiButtonFrame::SetPaper(c); };
}
void DropChoice::EnableDrop(bool b)

View file

@ -38,7 +38,7 @@ bool HelpWindow::GoTo0(const String& link)
}
if(WhenMatchLabel) {
WString lw = label.ToWString();
return view.GotoLabel([=](const WString& data) { return WhenMatchLabel(data, lw); }, true, true) || lnk;
return view.GotoLabel([this, lw](const WString& data) { return WhenMatchLabel(data, lw); }, true, true) || lnk;
}
return view.GotoLabel(label, true, true) || lnk;
}
@ -324,7 +324,7 @@ HelpWindow::HelpWindow()
Sizeable().Zoomable();
Title(t_("Help"));
BackPaint();
view.WhenLink = [=](const String& h) { GoTo(h); };
view.WhenLink = [this](const String& h) { GoTo(h); };
AddFrame(toolbar);
view.SetZoom(Zoom(1, 1));
zoom.m = 160;
@ -337,7 +337,7 @@ HelpWindow::HelpWindow()
SetBar();
tree.BackPaint();
view.BackPaintHint();
view.WhenMouseWheel = [=] (int zdelta, dword keyflags) {
view.WhenMouseWheel = [this] (int zdelta, dword keyflags) {
if(keyflags & K_CTRL) {
zoom.m = clamp((zoom.m / 5 + sgn(zdelta)) * 5, 60, 600);
SetZoom();

View file

@ -118,7 +118,7 @@ void MultiButton::MultiButtons()
if(droppush) {
SubButton& b = buttons.Add();
b.owner = this;
b.WhenPush = [=] { DropPush(); };
b.WhenPush = [this] { DropPush(); };
b.main = true;
droppush = false;
}

View file

@ -376,7 +376,7 @@ void TextCtrl::ViewLoading()
if(msecs(start) > 20) {
view_loading_pos = view->GetPos();
PostCallback([=] { ViewLoading(); });
PostCallback([this] { ViewLoading(); });
WhenViewMapping(view_loading_pos);
break;
}

View file

@ -360,7 +360,7 @@ void BufferPainter::FinishPathJob()
fillcount = jobcount;
Swap(cofill, cojob); // Swap to keep allocated rasters (instead of pick)
fill_job & [=] {
fill_job & [this] {
PAINTER_TIMING("CO FILL JOB");
int miny = ip->GetHeight() - 1;
int maxy = 0;