Skip to content

Commit

Permalink
Editor: fix crash when closing map (fixup bf79dbd)
Browse files Browse the repository at this point in the history
I had moved the creation of the map_context_refresher prior to deleting a context since I thought it was
necessary to not access invalid memory. Turns out doing that was wrong; doing so caused the crash.

However, this results in a slight change in the code's result: Before, it was taking a ptr to the
current context, modifying the container, and then creating the refresher. This allowed the size_changed_
variable to be correctly initialized. That variable is unused, though, so it makes no difference.
  • Loading branch information
Vultraz committed Apr 27, 2017
1 parent 0dfe846 commit cddc2d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/editor/map/context_manager.cpp
Expand Up @@ -997,7 +997,6 @@ void context_manager::create_default_context()
void context_manager::close_current_context()
{
if(!confirm_discard()) return;
map_context_refresher(*this, get_map_context());

if(map_contexts_.size() == 1) {
create_default_context();
Expand All @@ -1009,6 +1008,7 @@ void context_manager::close_current_context()
map_contexts_.erase(map_contexts_.begin() + current_context_index_);
}

map_context_refresher(*this, get_map_context());
set_window_title();
}

Expand Down

0 comments on commit cddc2d2

Please sign in to comment.