Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@
widget->mType = type;
widget->mRect = rect;
widget->mParent = setParent(ctx, widget, parentId);
if (widget->mParent == nullptr) {
assert(widget->mParent != nullptr);
delete widget;

Check failure on line 137 in src/widgets.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rewrite the code so that you no longer need this "delete".

See more on https://sonarcloud.io/project/issues?id=kimkulling_tiny_ui&issues=AZ54Z67cUqANC3p5g0BZ&open=AZ54Z67cUqANC3p5g0BZ&pullRequest=42
widget = nullptr;
}

return widget;
}
Expand Down Expand Up @@ -223,7 +228,11 @@
if (currentChild->mRect.isIn(x, y)) {
*found = currentChild;
for ( auto &child : currentChild->mChildren) {
if (child->mRect.isIn(x, y)){
if (!child->isEnabled()) {
continue;
}

if (child->mRect.isIn(x, y)) {
findSelectedWidget(x, y, child, found);
}
}
Expand Down
Loading