widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11691
[Merge] lp:~widelands-dev/widelands/scenario_types_used_before_initialized into lp:widelands
Jukka Pakarinen has proposed merging lp:~widelands-dev/widelands/scenario_types_used_before_initialized into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/scenario_types_used_before_initialized/+merge/334285
When "New Game" button is pressed on the "Single Player" view, Valgrind detects that there is some value(s) used before initialization.
==6183== Conditional jump or move depends on uninitialised value(s)
==6183== at 0xD65F0A: FullscreenMenuMapSelect::fill_table() (mapselect.cc:257)
==6183== by 0xD6674F: FullscreenMenuMapSelect::tagbox_changed(int, bool) (mapselect.cc:340)
==6183== by 0xD6B0AF: boost::_mfi::mf2<void, FullscreenMenuMapSelect, int, bool>::operator()(FullscreenMenuMapSelect*, int, bool) const (mem_fn_template.hpp:280)
The commit in the branch moves the initialization of scenario_types_ variable before the first call of fill_table method. Valgrind doesn't give the message wtih the fix.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/scenario_types_used_before_initialized into lp:widelands.
=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc 2017-11-05 19:59:33 +0000
+++ src/ui_fsmenu/mapselect.cc 2017-11-26 14:52:10 +0000
@@ -83,6 +83,8 @@
UI::Box* hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
+ scenario_types_ = settings_->settings().multiplayer ? Map::MP_SCENARIO : Map::SP_SCENARIO;
+
// Must be initialized before tag checkboxes
cb_dont_localize_mapnames_ =
new UI::Checkbox(hbox, Vector2i::zero(), _("Show original map names"));
@@ -116,8 +118,6 @@
add_tag_checkbox(hbox, "4teams", localize_tag("4teams"));
checkboxes_.add(hbox, UI::Box::Resizing::kFullSize);
- scenario_types_ = settings_->settings().multiplayer ? Map::MP_SCENARIO : Map::SP_SCENARIO;
-
table_.focus();
fill_table();
Follow ups