Merge lp:~widelands-dev/widelands/bug_1826669_MapDownloandChange into lp:widelands/build20

Proposed by Klaus Halfmann
Status: Rejected
Rejected by: Toni Förster
Proposed branch: lp:~widelands-dev/widelands/bug_1826669_MapDownloandChange
Merge into: lp:widelands/build20
Diff against target: 60 lines (+16/-3)
3 files modified
src/network/gameclient.cc (+6/-3)
src/network/gamehost.cc (+2/-0)
src/network/network.h (+8/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug_1826669_MapDownloandChange
Reviewer Review Type Date Requested Status
Toni Förster testing, playing, compiling Approve
Review via email: mp+366616@code.launchpad.net

Commit message

Fix for #1826669

Description of the change

Avoid double delete of _file in gameclient.cc

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

This will merge to buld20.

I will try to do a bigger refactoring for trunk, but we should merge it there, too.

Revision history for this message
Toni Förster (stonerl) wrote :

Tested with Klaus and this fixes the crash.

review: Approve (testing, playing, compiling)
Revision history for this message
GunChleoc (gunchleoc) wrote :

I have an alternative fix that will use unique_ptr. We are trying to get away from raw delete calls. Tested with 2 Ubuntu machines.

https://code.launchpad.net/~widelands-dev/widelands/bug-1826669-mp-map-b20/+merge/366617

Revision history for this message
GunChleoc (gunchleoc) wrote :
Revision history for this message
GunChleoc (gunchleoc) wrote :

Woohoo, forgot to tick the checkbox too. Now I finally have the correct target branch: https://code.launchpad.net/~widelands-dev/widelands/bug-1826669-mp-map-b20/+merge/366619

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

Shouldn't this merge request being dropped an th branch abandoned since it was fixed by another branch?

Revision history for this message
Toni Förster (stonerl) wrote :

Set to rejected since we already have merged Gun's branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/network/gameclient.cc'
2--- src/network/gameclient.cc 2019-02-23 11:00:49 +0000
3+++ src/network/gameclient.cc 2019-04-28 12:08:11 +0000
4@@ -586,8 +586,10 @@
5 d->settings.mapfilename.c_str());
6
7 // New map was set, so we clean up the buffer of a previously requested file
8- if (file_)
9- delete file_;
10+ if (file_) {
11+ delete file_;
12+ file_ = NULL;
13+ }
14 break;
15 }
16
17@@ -637,8 +639,9 @@
18 s.unsigned_8(NETCMD_NEW_FILE_AVAILABLE);
19 d->net->send(s);
20
21- if (file_)
22+ if (file_) {
23 delete file_;
24+ }
25
26 file_ = new NetTransferFile();
27 file_->bytes = bytes;
28
29=== modified file 'src/network/gamehost.cc'
30--- src/network/gamehost.cc 2019-02-23 11:00:49 +0000
31+++ src/network/gamehost.cc 2019-04-28 12:08:11 +0000
32@@ -539,7 +539,9 @@
33 d->net.reset();
34 d->promoter.reset();
35 delete d;
36+ d = NULL;
37 delete file_;
38+ file_ = NULL;
39 }
40
41 const std::string& GameHost::get_local_playername() const {
42
43=== modified file 'src/network/network.h'
44--- src/network/network.h 2019-02-23 11:00:49 +0000
45+++ src/network/network.h 2019-04-28 12:08:11 +0000
46@@ -185,6 +185,14 @@
47 std::string filename;
48 std::string md5sum;
49 std::vector<FilePart> parts;
50+
51+ NetTransferFile() {
52+ // Allow Debugging
53+ }
54+
55+ ~NetTransferFile() {
56+ // Allow Debugging
57+ }
58 };
59
60 class Deserializer {

Subscribers

People subscribed via source and target branches

to all changes: