bugBattle for Wesnoth - Bugs: bug #21127, problems with wml_menu_item class

Show feedback again

bug #21127: problems with wml_menu_item class

Submitted by:  Anonymissimus <anonymissimus>
Submitted on:  Tue Sep 10 18:41:21 2013  
Category: BugSeverity: 4 - Important
Priority: 5 - NormalItem Group:  None of the others
Status: FixedPrivacy: Public
Assigned to: J Tyne <jamit>Open/Closed: Closed
Release: 1.11.6+dev@83a92beb4550f2d220b05170490d8Operating System: win xp

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Sat Sep 14 17:14:54 2013, comment #4:

Should be fixed with https://github.com/wesnoth/wesnoth-old/commit/04c0a8f01193ac843b34744fa51a7a7b53168b93

I also added some comments to warn others about this pitfall.

J Tyne <jamit>
Project MemberIn charge of this item.
Fri Sep 13 13:07:43 2013, comment #3:

I have a theory. If you want to test the theory before I get a chance to, change line 422 of handlers.cpp from


That is probably not the proper fix, but if my theory is right, that should fix this symptom.

J Tyne <jamit>
Project MemberIn charge of this item.
Fri Sep 13 10:18:47 2013, comment #2:

My debugger behaves differently depending on whether there are references at least. This doesn't neccessarily mean they make a difference as the debugger often plays tricks with me.

Even if you don't get a crash, gdb should be able to display you suspicious values in the show_if_ and filter_location_ fields once execution reaches wml_menu_item::to_config as opposed to when leaving wml_menu_item::update. The MinGw binary sometimes crashes for me. Note that only these two vconfig fields seem affected, the config command one is not. Show_if_ contains garbage if and only if the [set_menu_item] its instance of the class comes from contains such tag, analog for filter_location_.

Anonymissimus <anonymissimus>
Project Member
Fri Sep 13 02:17:13 2013, comment #1:

The references shouldn't make a difference if the compiler is doing any optimizations (vconfig::child() returns an object, not a reference). At the same time, it's an easy enough change to work in.

The crash will take some looking into. I don't see how defining an assignment operator would help, since the default field-by-field assignment should be fine. Hmm... An initial test run is not crashing for me. Maybe I'll be able to find something this weekend?

J Tyne <jamit>
Project MemberIn charge of this item.
Tue Sep 10 18:41:21 2013, original submission:

In wml_menu_item::update(const vconfig & vcfg) there should be references. Here's the fiff:

However, I still get a crash similar to this trace once a scenario attempts to autosave at start:
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.

Anonymissimus <anonymissimus>
Project Member


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by jamit (Posted a comment)
  • -unavailable- added by anonymissimus (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Sep 14 17:14:54 2013jamitStatusNone=>Fixed
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup