From 84e1915b7518d611e0379f926691a0b1f7a9e430 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 3 Sep 2018 23:33:02 +0200 Subject: [PATCH] fixed bug with overwriting level file info from level template This bug (which was causing crashes due to double free()ing strings) was a nasty side effect of changing string pointers in the file info structure from using string references (allocated and freed somewhere else) to copies of strings allocated and freed for each change, while still copying the file info from the level template over to the file info of the level file in function "ActivateLevelTemplate()" (causing duplicates of string pointers which were therefore freed twice). This bug was most probably the real cause for the problems fixed by the changes in commit 759e0bea. --- src/files.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/files.c b/src/files.c index efbc26f8..21bede9a 100644 --- a/src/files.c +++ b/src/files.c @@ -1915,6 +1915,9 @@ static void ActivateLevelTemplate() /* overwrite all individual level settings from template level settings */ level = level_template; + /* restore level file info */ + level.file_info = level_backup.file_info; + /* restore playfield size */ level.fieldx = level_backup.fieldx; level.fieldy = level_backup.fieldy; -- 2.34.1