Skip to content

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Aug 31, 2025

To be able to implement #5978, split container nodes need to be able to be passed to Lua. We could pass pointers, but that could result in a use-after-free. The object passed to Lua has to somehow know that a container node is no longer with us. We can do this with shared pointers (by giving Lua a weak reference to a node)

This PR refactors split nodes to use shared pointers to decouple from the Lua implementation.

@Nerixyz Nerixyz force-pushed the refactor/split-sp branch from d98e50d to e123e52 Compare August 31, 2025 19:43
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

qreal totalSize = std::accumulate(
this->children_.begin(), this->children_.end(), qreal(0),
[=, this](int val, std::unique_ptr<Node> &node) {
[=, this](int val, const auto &node) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: lambdas that capture 'this' should not specify a by-value capture default [cppcoreguidelines-misleading-capture-default-by-value]

Suggested change
[=, this](int val, const auto &node) {
[isVertical, totalFlex, minSize, this](int val, const auto &node) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant