Merge lp:~widelands-dev/widelands/worker_fetchfromflag_crash into lp:widelands

Proposed by Benedikt Straub on 2019-03-17
Status: Merged
Merged at revision: 9018
Proposed branch: lp:~widelands-dev/widelands/worker_fetchfromflag_crash
Merge into: lp:widelands
Diff against target: 18 lines (+8/-0)
1 file modified
src/logic/map_objects/tribes/worker.cc (+8/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/worker_fetchfromflag_crash
Reviewer Review Type Date Requested Status
GunChleoc 2019-03-17 Approve on 2019-03-18
Review via email: mp+364650@code.launchpad.net

Commit message

Cancel Worker::fetchfromflag when the building is destroyed/dismantled/enhanced

Description of the change

Fix for the segfault reported on the forum (https://wl.widelands.org/forum/topic/2786/?page=26)

To post a comment you must log in.
9019. By Nordfriese on 2019-03-17

add molog

bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4601. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/507437211.
Appveyor build 4389. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_worker_fetchfromflag_crash-4389.

GunChleoc (gunchleoc) wrote :

Thanks for fixing :)

@bunnybot merge

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/map_objects/tribes/worker.cc'
2--- src/logic/map_objects/tribes/worker.cc 2019-03-02 11:21:02 +0000
3+++ src/logic/map_objects/tribes/worker.cc 2019-03-17 10:36:43 +0000
4@@ -2140,6 +2140,14 @@
5 }
6
7 void Worker::fetchfromflag_update(Game& game, State& state) {
8+ std::string signal = get_signal();
9+ if (signal.size()) {
10+ if (signal == "location") {
11+ molog("[fetchfromflag]: Building disappeared, become fugitive\n");
12+ return pop_task(game);
13+ }
14+ }
15+
16 PlayerImmovable& employer = *get_location(game);
17 PlayerImmovable* const location =
18 dynamic_cast<PlayerImmovable*>(game.map().get_immovable(get_position()));