Title WP path pointing towards noexisting WP; game hangs at map load
Priority release-blocker Status resolved
Assigned To fluzz Keywords
Linked issues Watchers fluzz

Submitted on 2015-05-25 17h11 by matthiaskrgr, last changed by fluzz.

File name Uploaded Type Edit Remove
wp.png matthiaskrgr, 2015-11-23.21:11:18 image/png
Author: matthiaskrgr Date: 2015-05-25   17h11
in the levels.dat, it looks somewhat like this:

diff --git a/map/levels.dat b/map/levels.dat
index cd76d67..6eff409 100644
--- a/map/levels.dat
+++ b/map/levels.dat
@@ -12624,6 +12624,7 @@ Nr.=106 x=  39 y=  29 rnd=0      c:  105 107
 Nr.=107 x=  35 y=  30 rnd=0     c:   90 106  89
 Nr.=108 x=  54 y=  17 rnd=1     c:   13  12
 Nr.=109 x=  66 y=  76 rnd=0     c:   41  44
+Nr.=110 x=  45 y=  44 rnd=0     c:  111
 Levelnumber: 10

you can see we have a connection from WP110 to WP111, but there is now WP111.

how to reproduce:

1) plant single WP1 without connection
2) plant nearby WP2 without connection
3) select WP2
4) draw connection from WP1 to WP2
5) delete WP2 via ctrl+x
6) the connection will reset in a strange way, now originating from no waypoint
7) now draw the connection back to WP1.
Tada => broken connection

the map validator does not warn about this.
Author: fluzz Date: 2015-11-04   18h30
I can not reproduce. After step 5, the connection is totally deleted.
Was this bug already fixed ?
Author: matthiaskrgr Date: 2015-11-23   21h10
The bug is not fixed yet.

I can reproduce a memory leak when doing the bug:

Direct leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x7f56d5492ba9 in __interceptor_calloc (/lib64/
    #1 0x4580c2 in dynarray_init /home/matthias/vcs/git/freedroid/src/dynarray.c:37
    #2 0x5a7c85 in add_waypoint /home/matthias/vcs/git/freedroid/src/waypoint.c:55
    #3 0x5db60f in do_waypoint_route lvledit/lvledit_tool_place.c:87
    #4 0x5dbc80 in leveleditor_place_input lvledit/lvledit_tool_place.c:712
    #5 0x608f2a in forward_event lvledit/lvledit_widget_map.c:53
    #6 0x608f2a in map_handle_event lvledit/lvledit_widget_map.c:94
    #7 0x6384bb in group_mouse_event widgets/widget_group.c:89
    #8 0x6384bb in widget_group_handle_event widgets/widget_group.c:183
    #9 0x632fda in handle_widget_event widgets/widgets.c:281
    #10 0x4b364a in input_handle /home/matthias/vcs/git/freedroid/src/input.c:135
    #11 0x5cba2d in leveleditor_process_input lvledit/lvledit_input.c:186
    #12 0x5af9ec in LevelEditor lvledit/lvledit.c:282
    #13 0x4199e4 in main /home/matthias/vcs/git/freedroid/src/main.c:183
    #14 0x7f56d2e2757f in __libc_start_main (/lib64/

shorter recipe:
 1) plant WP1  via RMB, get rid of connection via LMB
 2) plant WP2, when you got the connection on your cursor now, press "z"
removing the originating waypoint (you will still have the connection on your
 3) link connection to WP1
 4) LMB to get rid of the new connection originating from WP1

If you save that and load it, the game will hang
Author: matthiaskrgr Date: 2015-11-23   21h11
added screenshot

Attached wp.png.
Author: fluzz Date: 2015-11-24   17h49
See proposed fix at
Author: fluzz Date: 2015-11-26   09h16
fixed in commit f7cf2df
Date User Action Args
2015-11-26 09:16:55fluzzsetstatus: open -> resolved
messages: + msg3291
2015-11-24 17:49:29fluzzsetassignedto: fluzz
messages: + msg3285
nosy: + fluzz
2015-11-23 21:11:18matthiaskrgrsetfiles: + wp.png
messages: + msg3283
2015-11-23 21:10:54matthiaskrgrsetmessages: + msg3282
2015-11-04 18:30:24fluzzsetmessages: + msg3273
2015-05-25 17:11:13matthiaskrgrcreate