MantisBT - VCMI
View Issue Details
0001281VCMIGUI - Town screenpublic2013-05-29 20:482014-05-30 17:43
Zamolxis 
Tow 
normalcrashalways
closedfixed 
x86_64Windows7 VAIO
0.92c 
0.93 
0001281: Crash when building Tavern in Castle town on a loaded game
Map is VCMI_Tests_2012, Castle town is fully built from Map Editor (Grail included), except for Tavern. We can build Tavern if we start a new game, but if it's loaded from a save, the game crashes. As per screenshots, sometimes it crashes just before, sometimes just after the Tavern appears in the town screen.

Crashdump + save attached (game saved at start, no actions before).

This was not there in 0.92. I cannot test if it's introduced in 0.92b, because in there we couldn't build anything in a loaded game.

This is a split from a discussion started in the notes of 0001272. As posted there, Ivan found it's something with the bonus system (duplicate lighthouse bonus? - see also console message in 2nd screenshot pointing the same):

Crash on server, stacktrace:
0 ?? 0x3266250
1 CBonusSystemNode::unpropagateBonus HeroBonus.cpp 817
2 CBonusSystemNode::removeBonus HeroBonus.cpp 783
3 CGTownInstance::recreateBuildingsBonuses CObjectHandler.cpp 2489
4 NewStructures::applyGs NetPacksLib.cpp 444
5 CApplyOnGS<NewStructures>::applyOnGS CGameState.cpp 72
6 CGameState::apply CGameState.cpp 1849
7 CGameHandler::sendAndApply CGameHandler.cpp 2150
8 CGameHandler::sendAndApply CGameHandler.cpp 2182
9 CGameHandler::buildStructure CGameHandler.cpp 2486
10 BuildStructure::applyGh NetPacksServer.cpp 113
11 CApplyOnGH<BuildStructure>::applyOnGH CGameHandler.cpp 87

Maybe someone familiar with the bonus system can take care of it; and maybe also check if we can expect a similar bug on other towns.
No tags attached.
related to 0001272closed Ivan Cannot build in town after loading 
jpg 2013-05-29_BuildTavernCrash.jpg (96,032) 2013-05-29 20:48
https://bugs.vcmi.eu/file_download.php?file_id=1288&type=bug
jpg

7z 2013-05-29_BuildTavernCrash.7z (240,904) 2013-05-29 20:48
https://bugs.vcmi.eu/file_download.php?file_id=1289&type=bug
jpg 2013-05-29_BuildTavernCrash2.jpg (100,008) 2013-05-29 20:49
https://bugs.vcmi.eu/file_download.php?file_id=1290&type=bug
jpg
Issue History
2013-05-29 20:48ZamolxisNew Issue
2013-05-29 20:48ZamolxisStatusnew => assigned
2013-05-29 20:48ZamolxisAssigned To => Tow
2013-05-29 20:48ZamolxisFile Added: 2013-05-29_BuildTavernCrash.jpg
2013-05-29 20:48ZamolxisIssue generated from: 0001272
2013-05-29 20:48ZamolxisRelationship addedrelated to 0001272
2013-05-29 20:48ZamolxisFile Added: 2013-05-29_BuildTavernCrash.7z
2013-05-29 20:49ZamolxisFile Added: 2013-05-29_BuildTavernCrash2.jpg
2013-05-29 20:52ZamolxisDescription Updatedbug_revision_view_page.php?rev_id=2226#r2226
2013-05-29 20:54ZamolxisDescription Updatedbug_revision_view_page.php?rev_id=2227#r2227
2013-05-29 21:00TowNote Added: 0003598
2013-05-30 10:47TowNote Added: 0003600
2013-05-30 10:47TowStatusassigned => resolved
2013-05-30 10:47TowFixed in Version => 0.93
2013-05-30 10:47TowResolutionopen => fixed
2014-05-30 17:43beegeeStatusresolved => closed

Notes
(0003598)
Tow   
2013-05-29 21:00   
This is issue with serializing shared_ptr. The pointers are set to the same object but they are not set to the same shared state.
Serializer should do that but it was not implemented and I won't have time to fix it by 0.93.
I'll try to put some workaround to make this bug not visible.
(0003600)
Tow   
2013-05-30 10:47   
Fixed in r3394.

I've improved support for shared_ptr serialization.
Still not complete but AFAIK should be enough for now. Added an assertion if it is not, so it'll be clear.

The duplicated bonus is another issue (not really harmful) that I'll investigate later.