fixed bug with potentially changing global variable in thread
authorHolger Schemel <info@artsoft.org>
Wed, 23 Jun 2021 07:52:38 +0000 (09:52 +0200)
committerHolger Schemel <info@artsoft.org>
Wed, 23 Jun 2021 08:07:17 +0000 (10:07 +0200)
When automatically incrementing level after solved game, the global
variable to store the level number may be changed while the thread
to upload the score to the server is just using it, which may cause
the score to be submitted for the wrong level number.

To fix this, the (already existing) local variable with the level
number is used instead.

src/files.c

index 2daffc83846a1a7c3e3fb7dea3c7eb6ec105bd6b..8c37e1c01fde9d33f1583e3e8f25f21f96936dab 100644 (file)
@@ -9311,7 +9311,7 @@ static void UploadScoreToServerExt(struct HttpRequest *request,
           levelset_author,
           leveldir_current->levels,
           leveldir_current->first_level,
-          level_nr,
+          nr,
           level_name,
           level_author,
           level.rate_time_over_score,