GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

"Wait" causes permanent alteration to local variable declaration if another's value is set

Open Granshmeyr opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

Describe the bug

Setting the value of local variable foo in any event can permanently alter the declared value of local variable bar. The declaration of bar, even if the setting of foo is thereafter bypassed, will be permanently altered. Note that this only occurs if there is a "Wait" event after the declaration of bar.

Events preview

image

Steps to reproduce

  1. Clone https://github.com/Granshmeyr/GDevelop-LocalVariableOverwrite-MRP
  2. Run game
  3. Press space to display the value of foo
  4. Wait for the "Wait" event to elapse (2 seconds)
  5. Press space and wait again
  6. Notice how the value of foo is still "Hello World!"
  7. Press enter to enable bar setting
  8. Press space and wait again
  9. Notice how the value of foo is now equal to the set value of bar in the event sheet
  10. Press enter to disable bar setting
  11. Notice how foo is now permanently declared with the value of bar for this runtime

GDevelop platform

Desktop

GDevelop version

5.4.204

Platform info

OS (e.g. Windows, Linux, macOS, Android, iOS) Windows

OS Version (e.g. Windows 10, macOS 10.15) Windows 11 Home (22H2)

Browser(For Web) (e.g. Chrome, Firefox, Safari) Not applicable

Device(For Mobile) (e.g. iPhone 12, Samsung Galaxy S21) Not applicable

Additional context

The variable being overwritten only gets overwritten after the "Wait" event finishes.

Granshmeyr avatar Jun 23 '24 03:06 Granshmeyr

Thanks a lot for reporting this issue and for the great reproduction explanations and project. It should be fixed in the next release.

D8H avatar Jun 25 '24 14:06 D8H

I suppose I can close this because I can confirm it is fixed in the latest update (5.4.205).

Granshmeyr avatar Jul 06 '24 14:07 Granshmeyr