Member variable DefaultAI::enemysites_check_delay_ used before initialization
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
After playing ten minutes the Crater map in Single Player mode against AI, Messages Inbox shows up with a Status message. In that moment Valgrind detects there is something that isn't initialized before it is used.
==18778== Conditional jump or move depends on uninitialised value(s)
==18778== at 0xF36229: DefaultAI:
==18778== by 0xED5197: DefaultAI::think() (defaultai.cc:438)
==18778== by 0xC97D1D: SinglePlayerGam
==18778== by 0xB535D4: Widelands:
==18778== by 0xDA0192: InteractiveBase
==18778== by 0xDBB2EF: InteractivePlay
==18778== by 0xD112D6: UI::Panel:
==18778== by 0xD10966: UI::Panel::do_run() (panel.cc:181)
==18778== by 0xA31433: UI::Panel:
==18778== by 0xB53292: Widelands:
==18778== by 0xA29FC6: WLApplication:
==18778== by 0xA293D3: WLApplication:
==18778==
I tracked the problem and found that enemysites_
Related branches
- GunChleoc: Approve
-
Diff: 11 lines (+1/-0)1 file modifiedsrc/ai/defaultai.cc (+1/-0)
Changed in widelands: | |
assignee: | nobody → Jukka Pakarinen (flegu) |
Changed in widelands: | |
status: | New → In Progress |
status: | In Progress → Fix Committed |
assignee: | Jukka Pakarinen (flegu) → nobody |
I tried to fix this and did the following change which removed the Valgrind message.
=== modified file 'src/ai/ defaultai. cc' in_const_ count_( 0), without_ trainers_ (0), road_building_ (0), check_delay_ (30), necessity_ water_needed_ (false) , nonmil_ prio_(0) , _economy( false),
--- src/ai/defaultai.cc 2017-11-20 07:54:19 +0000
+++ src/ai/defaultai.cc 2017-11-26 15:21:25 +0000
@@ -106,6 +106,7 @@
ts_
ts_
inhibit_
+ enemysites_
resource_
highest_
seafaring