[PR #291] Fix warning with lambda captuer mplicit capture of 'this' with a capture default of '=' for Gui01 (c++20 and above) #289

Open
opened 2026-05-05 03:44:53 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ultimatepp/ultimatepp/pull/291
Author: @klugier
Created: 7/5/2025
Status: 🔄 Open

Base: masterHead: klugier/lambda-captuer-warnings-gui-01


📝 Commits (2)

  • e909742 Fix warning with lambda captuer while compiling Gui01 tutorial.
  • c8f7793 Fix warning for clang compiling in c++17 mode.

📊 Changes

11 files changed (+16 additions, -15 deletions)

View changed files

📝 uppsrc/Core/CoWork.h (+1 -1)
📝 uppsrc/Core/FilterStream.h (+1 -1)
📝 uppsrc/Core/Function.h (+1 -1)
📝 uppsrc/CtrlLib/ColorPopup.cpp (+1 -1)
📝 uppsrc/CtrlLib/CtrlUtil.cpp (+3 -2)
📝 uppsrc/CtrlLib/DateTimeCtrl.h (+1 -1)
📝 uppsrc/CtrlLib/DropChoice.cpp (+2 -2)
📝 uppsrc/CtrlLib/Help.cpp (+3 -3)
📝 uppsrc/CtrlLib/MultiButton.cpp (+1 -1)
📝 uppsrc/CtrlLib/Text.cpp (+1 -1)
📝 uppsrc/Painter/Render.cpp (+1 -1)

📄 Description

It looks like fixing the issue with deprecation of capturing this with [=] won't be that difficult. I just wanted to start the whole process. I fixed this warning for Gui01 tutorail and associated pacakges, so right now while compiling Gui01 example with std=c++20 and above there shouldn't be following warning:
C:\Prototable\upp\git\uppsrc\CtrlLib\CtrlUtil.cpp (410): warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]

Also, I think the code is batter, because we are capturing variables we don't want to. I suggest making this kind of changes in chunks. At some point of time, we will eliminate all warnings of that kind.

I would like to add that maybe we might do not like the new syntax and it is longer to what we had in the past. But, the overall solution is batter, especially when you capture [this] instead of [=]. In this case the local variables are not copied. In the end we shouldn't consider silencing this warning. Also, at some point it might be a compilation error, so we will be forced to fix it.


The next step would be to fix all Gui* tutorials. After that we can jump to other places like ide.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ultimatepp/ultimatepp/pull/291 **Author:** [@klugier](https://github.com/klugier) **Created:** 7/5/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `klugier/lambda-captuer-warnings-gui-01` --- ### 📝 Commits (2) - [`e909742`](https://github.com/ultimatepp/ultimatepp/commit/e909742efd66d57a9693c59c620ccb5c8006aea1) Fix warning with lambda captuer while compiling Gui01 tutorial. - [`c8f7793`](https://github.com/ultimatepp/ultimatepp/commit/c8f7793b01b73d9e39511f02148598e676d5f772) Fix warning for clang compiling in c++17 mode. ### 📊 Changes **11 files changed** (+16 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `uppsrc/Core/CoWork.h` (+1 -1) 📝 `uppsrc/Core/FilterStream.h` (+1 -1) 📝 `uppsrc/Core/Function.h` (+1 -1) 📝 `uppsrc/CtrlLib/ColorPopup.cpp` (+1 -1) 📝 `uppsrc/CtrlLib/CtrlUtil.cpp` (+3 -2) 📝 `uppsrc/CtrlLib/DateTimeCtrl.h` (+1 -1) 📝 `uppsrc/CtrlLib/DropChoice.cpp` (+2 -2) 📝 `uppsrc/CtrlLib/Help.cpp` (+3 -3) 📝 `uppsrc/CtrlLib/MultiButton.cpp` (+1 -1) 📝 `uppsrc/CtrlLib/Text.cpp` (+1 -1) 📝 `uppsrc/Painter/Render.cpp` (+1 -1) </details> ### 📄 Description It looks like fixing the issue with deprecation of capturing this with [=] won't be that difficult. I just wanted to start the whole process. I fixed this warning for Gui01 tutorail and associated pacakges, so right now while compiling Gui01 example with std=c++20 and above there shouldn't be following warning: `C:\Prototable\upp\git\uppsrc\CtrlLib\CtrlUtil.cpp (410): warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]` Also, I think the code is batter, because we are capturing variables we don't want to. I suggest making this kind of changes in chunks. At some point of time, we will eliminate all warnings of that kind. I would like to add that maybe we might do not like the new syntax and it is longer to what we had in the past. But, the overall solution is batter, especially when you capture [this] instead of [=]. In this case the local variables are not copied. In the end we shouldn't consider silencing this warning. Also, at some point it might be a compilation error, so we will be forced to fix it. -------------------------------- The next step would be to fix all Gui* tutorials. After that we can jump to other places like ide. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror added the
pull-request
label 2026-05-05 03:44:53 -06:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#289
No description provided.