URL:
<http://gna.org/bugs/?21127>
Summary: problems with wml_menu_item class
Project: Battle for Wesnoth
Submitted by: anonymissimus
Submitted on: Di 10 Sep 2013 18:41:21 GMT
Category: Bug
Severity: 4 - Important
Priority: 5 - Normal
Item Group: None of the others
Status: None
Privacy: Public
Assigned to: jamit
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 1.11.6+dev@83a92beb4550f2d220b05170490d8
Operating System: win xp
_______________________________________________________
Details:
In wml_menu_item::update(const vconfig & vcfg) there should be references.
Here's the fiff:
++
diff --git a/src/gamestatus.cpp b/src/gamestatus.cpp
index 4f43928..fd3d338 100644
--- a/src/gamestatus.cpp
+++ b/src/gamestatus.cpp
@@ -159,10 +159,10 @@ void wml_menu_item::update(const vconfig & vcfg)
if ( vcfg.has_attribute("needs_select") )
needs_select_ = vcfg["needs_select"].to_bool();
- if ( const vconfig child = vcfg.child("show_if") )
+ if ( const vconfig& child = vcfg.child("show_if") )
show_if_ = child;
- if ( const vconfig child = vcfg.child("filter_location") )
+ if ( const vconfig& child = vcfg.child("filter_location") )
filter_location_ = child;
if ( const vconfig & cmd = vcfg.child("command") ) {
--
However, I still get a crash similar to this trace once a scenario attempts to
autosave at start:
++
>
> wesnoth.exe!std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,config::attribute_value,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>
>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,config::attribute_value> >,0> >::begin() Zeile 561 + 0xc Bytes
> C++
wesnoth.exe!config::attribute_range() Zeile 877 + 0x66 Bytes C++
wesnoth.exe!operator<<(std::basic_ostream<char,std::char_traits<char> >
&
outstream={...}, const config & cfg={...}) Zeile 1321 + 0x238 Bytes C++
wesnoth.exe!config::debug() Zeile 1313 + 0x10 Bytes C++
wesnoth.exe!wml_menu_item::to_config(config & cfg={...}) Zeile 143 +
0x39
Bytes C++
wesnoth.exe!wmi_container::to_config(config & cfg={...}) Zeile 224 +
0x3e
Bytes C++
wesnoth.exe!game_data::write_snapshot(config & cfg={...}) Zeile 915
C++
wesnoth.exe!game_state::write_snapshot(config & cfg={...}, game_display
*
gui=0x08939b20) Zeile 1246 C++
wesnoth.exe!savegame::ingame_savegame::before_save() Zeile 1153
C++
wesnoth.exe!savegame::savegame::save_game(CVideo * video=0x03df1394,
const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
filename="") Zeile 940 + 0xf Bytes C++
wesnoth.exe!savegame::savegame::save_game_automatic(CVideo &
video={...},
bool ask_for_overwrite=false, const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
filename="") Zeile 827 + 0x34 Bytes C++
wesnoth.exe!savegame::autosave_savegame::autosave(const bool
disable_autosave=false, const int autosave_max=10, const int
infinite_autosaves=61) Zeile 1092 + 0x41 Bytes C++
wesnoth.exe!playsingle_controller::before_human_turn(savegame::autosave_savegame
save={...}) Zeile 707 C++
wesnoth.exe!playmp_controller::before_human_turn(bool save=true) Zeile
106 C++
wesnoth.exe!playsingle_controller::play_side(const unsigned int
side_number=1, bool save=true) Zeile 651 + 0x17 Bytes C++
wesnoth.exe!playmp_controller::play_side(const unsigned int
side_number=1,
bool save=true) Zeile 100 C++
wesnoth.exe!playsingle_controller::play_turn(bool save=true) Zeile 604
+
0x21 Bytes C++
wesnoth.exe!playsingle_controller::play_scenario(const
std::pair<config::const_child_iterator,config::const_child_iterator> &
story=({i_=... },{i_=... }), bool skip_replay=false) Zeile 412 + 0x1a
Bytes C++
wesnoth.exe!playmp_scenario(const config & game_config={...}, const
config *
level=0x001229f0, display & disp={...}, game_state & state_of_game={...},
const std::pair<config::const_child_iterator,config::const_child_iterator> &
story=({i_=... },{i_=... }), bool skip_replay=false, io_type_t &
io_type=IO_SERVER, end_level_data & end_level={...}) Zeile 287 + 0x14
Bytes C++
wesnoth.exe!play_game(game_display & disp={...}, game_state &
gamestate={...}, const config & game_config={...}, io_type_t
io_type=IO_SERVER, bool skip_replay=false, bool network_game=false) Zeile 465
+ 0x2c Bytes C++
wesnoth.exe!enter_connect_mode(game_display & disp={...}, const config &
game_config={...}, game_state & state={...}, const mp_game_settings &
params={...}, bool local_players_only=true) Zeile 507 + 0x22 Bytes C++
wesnoth.exe!enter_configure_mode(game_display & disp={...}, const
config &
game_config={...}, game_state & state={...}, const mp_game_settings &
params={...}, bool local_players_only=true) Zeile 602 + 0x1d Bytes C++
wesnoth.exe!enter_create_mode(game_display & disp={...}, const config &
game_config={...}, game_state & state={...}, bool local_players_only=true)
Zeile 562 + 0x1d Bytes C++
wesnoth.exe!mp::start_local_game(game_display & disp={...}, const
config &
game_config={...}, game_state & state={...}) Zeile 750 + 0x13 Bytes C++
wesnoth.exe!game_controller::play_multiplayer() Zeile 849 + 0x3b Bytes
C++
wesnoth.exe!do_gameloop(int argc=3, char * * argv=0x0012fea0) Zeile
597 +
0x12 Bytes C++
wesnoth.exe!SDL_main(int argc=3, char * * argv=0x0012fea0) Zeile 695 +
0xd
Bytes C++
wesnoth.exe!_main() + 0xf5 Bytes C
--
It happens at the show_if_.get_config()/filter_location_.get_config() calls in
wml_menu_item::to_config(config & cfg) const because those members contain
garbage at that point. They are still correct in wml_menu_item::update(const
vconfig & vcfg) (and I don't find out now why is that, perhaps
wml_menu_item::operator= should be defined ?)
Here's some reproduction wml. Don't have other menu items in there.
++
[event]
name=turn 1
[set_menu_item]
first_time_only=no
id=one
description=_"1"
[command]
{DEBUG_MSG "1"}
[/command]
[/set_menu_item]
[set_menu_item]
first_time_only=no
id=show_if
description=_"show_if"
[show_if]
[have_unit]
id=nonexist
[/have_unit]
[/show_if]
[command]
{DEBUG_MSG "show_if"}
[/command]
[/set_menu_item]
[set_menu_item]
first_time_only=no
id=filter_loc
description=_"filter_loc"
[filter_location]
[filter]
[/filter]
[/filter_location]
[command]
{DEBUG_MSG "filter_loc"}
[/command]
[/set_menu_item]
[/event]
--
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?21127>
_______________________________________________
Nachricht gesendet von/durch Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs