Skip to content

Commit

Permalink
fix segfault in loadingscreen when staring campaigns,
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Mar 30, 2016
1 parent 2b565b9 commit 249792e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/game_display.cpp
Expand Up @@ -74,8 +74,8 @@ game_display::game_display(game_board& board, CVideo& video, boost::weak_ptr<wb:
const tod_manager& tod,
const config& theme_cfg,
const config& level,
bool dummy) :
display(&board, video, wb, reports_object, theme_cfg, level, !dummy),
bool) :
display(&board, video, wb, reports_object, theme_cfg, level, false),
overlay_map_(),
attack_indicator_src_(),
attack_indicator_dst_(),
Expand Down
6 changes: 2 additions & 4 deletions src/play_controller.cpp
Expand Up @@ -257,10 +257,6 @@ void play_controller::init(CVideo& video, const config& level)

LOG_NG << "building terrain rules... " << (SDL_GetTicks() - ticks()) << std::endl;
gui2::tloadscreen::progress("build terrain");
//NOTE: since the loading now happens in a sperate thread creating the game_display object here is dangerous.
// for example becasue it might registers an sdl_handler while the main thread is calling events::pump
//TODO: Find a way to move the sdl_handler::join() calls out of here.

gui_.reset(new game_display(gamestate().board_, video, whiteboard_manager_, *gamestate().reports_, gamestate().tod_manager_, theme_cfg, level));
if (!gui_->video().faked()) {
if (saved_game_.mp_settings().mp_countdown)
Expand Down Expand Up @@ -313,6 +309,8 @@ void play_controller::init(CVideo& video, const config& level)
plugins_context_->set_callback("save_replay", boost::bind(&play_controller::save_replay_auto, this, boost::bind(get_str, _1, "filename" )), true);
plugins_context_->set_callback("quit", throw_end_level(), false);
});
//Do this after the loadingscreen, so that ita happens in the main thread.
gui_->join();
}

void play_controller::reset_gamestate(const config& level, int replay_pos)
Expand Down

0 comments on commit 249792e

Please sign in to comment.