From cddc2d2f69194f6802635e66c016c1a0bafdfefc Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Fri, 28 Apr 2017 07:01:29 +1100 Subject: [PATCH] Editor: fix crash when closing map (fixup bf79dbd8) 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. --- src/editor/map/context_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/map/context_manager.cpp b/src/editor/map/context_manager.cpp index 648003d70d1e..43c76aae476d 100644 --- a/src/editor/map/context_manager.cpp +++ b/src/editor/map/context_manager.cpp @@ -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(); @@ -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(); }