Page MenuHomeWildfire Games

Fix frozen controlgroups after quickloading following rP22922
ClosedPublic

Authored by elexis on Nov 5 2019, 2:14 PM.

Details

Summary

The following error was reported by minohaka on http://irclogs.wildfiregames.com/2019-11/2019-11-04-QuakeNet-%230ad-dev.log

ERROR: JavaScript error: gui/session/selection.js line 88TypeError: property 274 is non-configurable and can't be deleted
  EntityGroups.prototype.removeEnt@gui/session/selection.js:88:2
  EntityGroupsContainer.prototype.update@gui/session/selection.js:496:5
  updateGroups@gui/session/session.js:672:2
  updateGUIObjects@gui/session/session.js:657:2
  onSimulationUpdate@gui/session/session.js:629:2
  __eventhandler56 (simulationupdate)@session simulationupdate:0:1

From the replay file we can see that quickloading was used, from which one can derive how to reproduce the error:

  1. starts singleplayer match
  2. select an entity
  3. cltr+1 to assign it to a control group
  4. shift+F5 to perform quicksave
  5. shift+F8 to perform quickload
  6. delete that entity

Consequently the error was introduced by rP22922/D2302 providing an immutable JS object whose ownership was taken over in session.js restoreSavedGameData in g_Groups.groups[groupNumber].groups = data.groups[groupNumber].groups;.

Test Plan

Follow the steps to reproduce the issue to verify that they're gone, and that the controlgroups are saved and loaded correctly.

Notice that the freezing of the object is not the mistake but the benefit. Since if the freezing wouldn't have been there, the error message wouldn't have appeared, and the savestate would have changed merely by loading and resuming the match. The error was not using clones in JS or C++.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Nov 5 2019, 2:14 PM
elexis retitled this revision from Summary: The following error was reported by minohaka on http://irclogs.wildfiregames.com/2019-11/2019-11-05-QuakeNet-%230ad-dev.log ``` ERROR: JavaScript error: gui/session/selection.js line 88 TypeError: property 274 is non-configurable and... to Fix frozen controlgroups after quickloading following rP22922.Nov 5 2019, 2:22 PM
elexis edited the summary of this revision. (Show Details)
elexis edited the summary of this revision. (Show Details)Nov 5 2019, 2:24 PM
elexis edited the test plan for this revision. (Show Details)
elexis edited the summary of this revision. (Show Details)
Vulcan added a comment.Nov 5 2019, 2:29 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/538/display/redirect

Vulcan added a comment.Nov 5 2019, 2:30 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1051/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.Nov 5 2019, 3:24 PM
This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Nov 5 2019, 3:24 PM