Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3164 closed defect (fixed)

(De)serialisation fails on nested Map objects

Reported by: tom Owned by: Itms
Priority: Should Have Milestone: Alpha 19
Component: Core engine Keywords: patch
Cc: Patch:

Description (last modified by sanderd17)

An error occurred loading the game, the game crashes. I tested 16528, the game fails to load a saved game, load game again after loading, the game crashes.

BTW: when I shut down the computer start your computer, start the game again loading the save game, the game crashes. My os is win8 64bit.

See forum for logs: http://wildfiregames.com/forum/index.php?showtopic=19804&hl=

Attachments (2)

nested_maps.diff (1.6 KB ) - added by sanderd17 9 years ago.
Workaround for the Auramanager, though it should probably be fixed in the C++ (de)serialisation part
aura_manager_maps.patch (6.7 KB ) - added by Itms 9 years ago.
Also includes some reordering of add/multiply to avoid any ordering mistake

Download all attachments as: .zip

Change History (14)

comment:1 by sanderd17, 9 years ago

Description: modified (diff)

comment:2 by sanderd17, 9 years ago

Ok, seems like it's a problem with the deserialization of nested Maps (which are used in the Auramanager).

by sanderd17, 9 years ago

Attachment: nested_maps.diff added

Workaround for the Auramanager, though it should probably be fixed in the C++ (de)serialisation part

comment:3 by tom, 9 years ago

Using your patches, the problem has since been fixed.

Last edited 9 years ago by tom (previous) (diff)

comment:4 by sanderd17, 9 years ago

Summary: Load map error!(De)serialisation fails on nested Map objects

comment:5 by sanderd17, 9 years ago

In 16591:

Revert r16512 until problems with nested maps are solved. Refs #3164

comment:6 by Itms, 9 years ago

Milestone: Alpha 19Alpha 20

comment:7 by elexis, 9 years ago

Before sanderd17 reverted that code above, I got some mysterious crashes and aura errors. Linking this ticket for completeness: #3188.

comment:8 by Itms, 9 years ago

Keywords: patch review added
Milestone: Alpha 20Alpha 19

I looked into the issue and it is not caused by the nested maps but by object references in maps. I would like to commit the following workaround, which clones the data before inserting it inside the map.

When it is committed, I will create a ticket for the references bug, containing a patch and some code to reproduce the error.

Please review the style and let me know.

by Itms, 9 years ago

Attachment: aura_manager_maps.patch added

Also includes some reordering of add/multiply to avoid any ordering mistake

comment:9 by leper, 9 years ago

Any reason for using that custom function instead of clone() (from globalscripts/utility.js)?

I'd prefer not naming it like it should be used by other components (So eg. starting with lower case like that ensureExists, though we did have internal funcs starting with _ some time ago. It seems all of those are now gone though).

Apart from that it looks good. Should we also commit the new map tests too?

comment:10 by Itms, 9 years ago

Owner: set to Itms
Resolution: fixed
Status: newclosed

In 16929:

Revert r16591.

The problem caused by nested Maps is actually #3374.
Cloning the data object saved by the AuraManager fixes #3188.
Also, using Map fixes a serialization problem, refs #3375.

On top of those changes, some reordering of add/multiply to avoid any ordering mistake.

Fixes #3164, Refs #3374

comment:11 by Itms, 9 years ago

Keywords: review removed

comment:12 by leper, 9 years ago

In 16954:

Test serialization of nested maps. Refs #3164, #3374.

Note: See TracTickets for help on using tickets.