Skip to content

Commit

Permalink
Fixed crash in gamestate inspector (fixes #4540)
Browse files Browse the repository at this point in the history
Changing the use of callbacks to NOTIFY_MODIFIED events (2adac53) made it so the widget reference
passed to the callback was now a tree view node and not the tree view itself.
  • Loading branch information
Vultraz committed Nov 3, 2019
1 parent f006b5c commit fcd81f4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/gui/dialogs/gamestate_inspector.cpp
Expand Up @@ -319,22 +319,22 @@ class gamestate_inspector::controller
{
}

void handle_stuff_list_item_clicked(widget& tree)
void handle_stuff_list_item_clicked(widget& node)
{
tree_view_node* selected = dynamic_cast<tree_view&>(tree).selected_item();
callbacks[selected->describe_path()](*selected);
tree_view_node& selected = dynamic_cast<tree_view_node&>(node);
callbacks[selected.describe_path()](selected);

// We recursively fold, but non-recursively unfold.
// This is because only one node on a level should be open at any given time.
// Furthermore, there's no need to remember that a subnode was open once the parent is closed.
if(!selected->is_root_node()) {
for(auto& node : selected->parent_node().children()) {
if(node.get() != selected) {
if(!selected.is_root_node()) {
for(auto& node : selected.parent_node().children()) {
if(node.get() != &selected) {
node->fold(true);
}
}

selected->unfold();
selected.unfold();
}

view_.update(model_);
Expand Down

0 comments on commit fcd81f4

Please sign in to comment.