Actions
Bug #12900
closedWMenuItem addSeperator segfaults in renderSelected with Bootstrap5 Theme
Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
08/08/2024
Due date:
% Done:
0%
Estimated time:
0:01 h
Description
Adding a separator in a WMenuItem
Segfaults, because there is no Anchor element
I added a null check and the problem goes away
Wt 4.10.4
Unless there is a deeper Problem, this is a really easy fix
void WMenuItem::renderSelected(bool selected)
{
WApplication *app = WApplication::instance();
std::string active = app->theme()->activeClass();
auto bs5Theme = std::dynamic_pointer_cast<WBootstrap5Theme>(app->theme());
if (active == "Wt-selected"){ // for CSS theme, our styles are messed up
removeStyleClass(!selected ? "itemselected" : "item", true);
addStyleClass(selected ? "itemselected" : "item", true);
} else {
if (bs5Theme) {
auto a = anchor();
if(a) // Added check for Null
a->toggleStyleClass(active, selected, true);
}
toggleStyleClass(active, selected, true);
}
}
Updated by Christian Meyer 3 months ago
Sorry, didn't check for duplicates:
Bug #12323 also Already noticed and has a pull request with the suggested change
Updated by Matthias Van Ceulebroeck 3 months ago
- Status changed from New to Rejected
- Estimated time changed from 0:01 h to 0:01 h
No worries.
I've Rejected
this one.
Actions