Merge lp://staging/~widelands-dev/widelands/bug-1695701-militarywindow-crash into lp://staging/widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8374
Proposed branch: lp://staging/~widelands-dev/widelands/bug-1695701-militarywindow-crash
Merge into: lp://staging/widelands
Diff against target: 75 lines (+17/-8)
3 files modified
src/logic/map_objects/tribes/militarysite.cc (+5/-3)
src/wui/buildingwindow.cc (+11/-5)
src/wui/buildingwindow.h (+1/-0)
To merge this branch: bzr merge lp://staging/~widelands-dev/widelands/bug-1695701-militarywindow-crash
Reviewer Review Type Date Requested Status
Klaus Halfmann code review, compile, short test Approve
GunChleoc Needs Resubmitting
Review via email: mp+325040@code.staging.launchpad.net

Commit message

Fix crash when a militarysite window is open while the enemy conquers it by sending a notification. Refactored out die() function to avoid code duplication.

To post a comment you must log in.
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Just ran into this (again?),
time to get it fixed.

Codew review:
  build all around *building_/building, building_->/building_, building_/&building_

LGTM

compiled, have an autosave a minute before being atacked an
get a crash at:

[Host]: Received ping from metaserver.
Forcing flag at (123, 19)
Segmentation fault: 11
maikafer:bug-1695701-militarywindow-crash klaus$

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 widelands 0x000000010dbed06f BuildingWindow::think() + 255 (buildingwindow.cc:153)
1 widelands 0x000000010daafb03 UI::Panel::do_think() + 51 (panel.cc:458)
2 widelands 0x000000010daafb23 UI::Panel::do_think() + 83 (panel.cc:458)

Mhh, this is quite some complex code there, Ill simply it and try again

review: Needs Fixing
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

I simpified the code a bit, but this makes the carsh just appear somewhere else.

Gun: do you need my savegame?

Will try with a debugger, later

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Mhh, thats ood, last "normal" code in Debugger is:

void Panel::do_think() {
    if (thinks())
 think();

I don get it, where/when is BuildingWindow::building_ set to null?

looks like building_ point to some reclaimed space?

review: Needs Fixing
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 2276. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/239306428.
Appveyor build 2111. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1695701_militarywindow_crash-2111.

Revision history for this message
GunChleoc (gunchleoc) wrote :

The problem was that the old building gets destroyed and a new one created in the same spot. This is partially done via scheduled playercommands, so we can have nondeterministic delays here.

Sending a note to the building window fixes the issue.

I'd still like to look some more at that conquering code though - it's overly complicated. Before the OneTribe change, we used to have "global" militarysites so that we could add other tribes' building types when conquering. This is no longer needed, so I think rather than destroying and recreating, we should be able to simply unconquer for old owner, change owner and conquer for new owner.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Changing the conquering code is not trivial, so I've decided to leave well enough alone. Lets merge this as it is if it fixes the crash & passes code review.

review: Needs Resubmitting
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Whatever you did, it fixed my crash.
I did play for a minute only, though.

Lets check the code again ...
... as of the revert, this is much shorter now :-)

LGTM

review: Approve (code review, compile, short test)
Revision history for this message
GunChleoc (gunchleoc) wrote :

Basically, I'm telling the window to close before the building starts all that complicated transforming stuff.

Thanks for the review!

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: