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

Proposed by Benedikt Straub
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 Approve
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.
Revision history for this message
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.

Revision history for this message
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
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc 2019-03-02 11:21:02 +0000
+++ src/logic/map_objects/tribes/worker.cc 2019-03-17 10:36:43 +0000
@@ -2140,6 +2140,14 @@
2140}2140}
21412141
2142void Worker::fetchfromflag_update(Game& game, State& state) {2142void Worker::fetchfromflag_update(Game& game, State& state) {
2143 std::string signal = get_signal();
2144 if (signal.size()) {
2145 if (signal == "location") {
2146 molog("[fetchfromflag]: Building disappeared, become fugitive\n");
2147 return pop_task(game);
2148 }
2149 }
2150
2143 PlayerImmovable& employer = *get_location(game);2151 PlayerImmovable& employer = *get_location(game);
2144 PlayerImmovable* const location =2152 PlayerImmovable* const location =
2145 dynamic_cast<PlayerImmovable*>(game.map().get_immovable(get_position()));2153 dynamic_cast<PlayerImmovable*>(game.map().get_immovable(get_position()));

Subscribers

People subscribed via source and target branches

to status/vote changes: