{"action":"closed","issue":{"url":"https://api.github.com/repos/clintbellanger/flare-engine/issues/1406","labels_url":"https://api.github.com/repos/clintbellanger/flare-engine/issues/1406/labels{/name}","comments_url":"https://api.github.com/repos/clintbellanger/flare-engine/issues/1406/comments","events_url":"https://api.github.com/repos/clintbellanger/flare-engine/issues/1406/events","html_url":"https://github.com/clintbellanger/flare-engine/issues/1406","id":86668836,"number":1406,"title":"Crash when repeatedly go in/go out of a map","user":{"login":"sgadrat","id":7785759,"avatar_url":"https://avatars.githubusercontent.com/u/7785759?v=3","gravatar_id":"","url":"https://api.github.com/users/sgadrat","html_url":"https://github.com/sgadrat","followers_url":"https://api.github.com/users/sgadrat/followers","following_url":"https://api.github.com/users/sgadrat/following{/other_user}","gists_url":"https://api.github.com/users/sgadrat/gists{/gist_id}","starred_url":"https://api.github.com/users/sgadrat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgadrat/subscriptions","organizations_url":"https://api.github.com/users/sgadrat/orgs","repos_url":"https://api.github.com/users/sgadrat/repos","events_url":"https://api.github.com/users/sgadrat/events{/privacy}","received_events_url":"https://api.github.com/users/sgadrat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/clintbellanger/flare-engine/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"dorkster","id":913982,"avatar_url":"https://avatars.githubusercontent.com/u/913982?v=3","gravatar_id":"","url":"https://api.github.com/users/dorkster","html_url":"https://github.com/dorkster","followers_url":"https://api.github.com/users/dorkster/followers","following_url":"https://api.github.com/users/dorkster/following{/other_user}","gists_url":"https://api.github.com/users/dorkster/gists{/gist_id}","starred_url":"https://api.github.com/users/dorkster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorkster/subscriptions","organizations_url":"https://api.github.com/users/dorkster/orgs","repos_url":"https://api.github.com/users/dorkster/repos","events_url":"https://api.github.com/users/dorkster/events{/privacy}","received_events_url":"https://api.github.com/users/dorkster/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/clintbellanger/flare-engine/milestones/2","html_url":"https://github.com/clintbellanger/flare-engine/milestones/Pre-1.0","labels_url":"https://api.github.com/repos/clintbellanger/flare-engine/milestones/2/labels","id":189845,"number":2,"title":"Pre-1.0","description":"","creator":{"login":"igorko","id":1015344,"avatar_url":"https://avatars.githubusercontent.com/u/1015344?v=3","gravatar_id":"","url":"https://api.github.com/users/igorko","html_url":"https://github.com/igorko","followers_url":"https://api.github.com/users/igorko/followers","following_url":"https://api.github.com/users/igorko/following{/other_user}","gists_url":"https://api.github.com/users/igorko/gists{/gist_id}","starred_url":"https://api.github.com/users/igorko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorko/subscriptions","organizations_url":"https://api.github.com/users/igorko/orgs","repos_url":"https://api.github.com/users/igorko/repos","events_url":"https://api.github.com/users/igorko/events{/privacy}","received_events_url":"https://api.github.com/users/igorko/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":137,"state":"open","created_at":"2012-10-05T06:05:07Z","updated_at":"2015-06-09T23:06:01Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-06-09T17:09:26Z","updated_at":"2015-06-09T23:06:01Z","closed_at":"2015-06-09T23:06:01Z","body":"Steps to reproduce :\r\n\r\n * Modify the devlab mod to put a cursed_graved in the first room\r\n * Play heavilly with your left/right arrows to rapidly move the character throught the door\r\n * Continue, flare-engine will segfault sooner or later (takes around ~30 seconds for me)\r\n\r\nTested on commit e634b2b (before patches about preloading enemies) compiled in Debug mode.\r\n\r\nBegining of analysis :\r\n\r\nA possible cause would be an power summoning a zombie being placed in PowerManager.enemies while in the room with the cursed_grave, so having the cursed_graved as summoner. Changing room leading to a destruction of the cursed_grave and its StatBlock object. Runing the logic of EnemyManager, particularily handleSpawn(), using the enemy in PowerManager.enemies that now references an invalid StatBlock as summoner.\r\n\r\nAnd here is the backtrace (against commit e634b2b) :\r\n\r\n```\r\n#0  0x00000000006198b3 in __gnu_cxx::__ops::_Iter_equals_val<StatBlock* const>::operator()<__gnu_cxx::__normal_iterator<StatBlock**, std::vector<StatBlock*, std::allocator<StatBlock*> > > > (\r\n    this=0x7ffeb664a3c0, __it=<error reading variable: Cannot access memory at address 0x700000006>) at /usr/include/c++/5.1.0/bits/predefined_ops.h:194\r\nNo locals.\r\n#1  0x000000000061964e in std::__find_if<__gnu_cxx::__normal_iterator<StatBlock**, std::vector<StatBlock*, std::allocator<StatBlock*> > >, __gnu_cxx::__ops::_Iter_equals_val<StatBlock* const> > (\r\n    __first=<error reading variable: Cannot access memory at address 0x700000006>, __last=<error reading variable: Cannot access memory at address 0x80000000c>, __pred=...)\r\n    at /usr/include/c++/5.1.0/bits/stl_algo.h:120\r\n        __trip_count = 134217728\r\n#2  0x0000000000619425 in std::__find_if<__gnu_cxx::__normal_iterator<StatBlock**, std::vector<StatBlock*, std::allocator<StatBlock*> > >, __gnu_cxx::__ops::_Iter_equals_val<StatBlock* const> > (\r\n    __first=<error reading variable: Cannot access memory at address 0x700000006>, __last=<error reading variable: Cannot access memory at address 0x80000000c>, __pred=...)\r\n    at /usr/include/c++/5.1.0/bits/stl_algo.h:162\r\nNo locals.\r\n#3  0x00000000006191b7 in std::find<__gnu_cxx::__normal_iterator<StatBlock**, std::vector<StatBlock*, std::allocator<StatBlock*> > >, StatBlock*> (\r\n    __first=<error reading variable: Cannot access memory at address 0x700000006>, __last=<error reading variable: Cannot access memory at address 0x80000000c>, __val=@0x7ffeb664a4c8: 0x30d30d0)\r\n    at /usr/include/c++/5.1.0/bits/stl_algo.h:3791\r\nNo locals.\r\n#4  0x000000000061898e in StatBlock::removeFromSummons (this=0x30d30d0) at /home/sylvain/workspace/flare-engine/src/StatBlock.cpp:771\r\n        parent_ref = \r\n#5  0x0000000000617d29 in StatBlock::~StatBlock (this=0x30d30d0, __in_chrg=<optimized out>) at /home/sylvain/workspace/flare-engine/src/StatBlock.cpp:660\r\nNo locals.\r\n#6  0x00000000004ed347 in Entity::~Entity (this=0x30d3070, __in_chrg=<optimized out>) at /home/sylvain/workspace/flare-engine/src/Entity.cpp:476\r\nNo locals.\r\n#7  0x00000000005225ef in Enemy::~Enemy (this=0x30d3070, __in_chrg=<optimized out>) at /home/sylvain/workspace/flare-engine/src/Enemy.cpp:174\r\nNo locals.\r\n#8  0x0000000000522629 in Enemy::~Enemy (this=0x30d3070, __in_chrg=<optimized out>) at /home/sylvain/workspace/flare-engine/src/Enemy.cpp:177\r\nNo locals.\r\n#9  0x00000000005269f1 in EnemyManager::handleNewMap (this=0x2d40b40) at /home/sylvain/workspace/flare-engine/src/EnemyManager.cpp:88\r\n        i = 0\r\n        me = {type = \"\", pos = {x = 0, y = 0}, direction = 7, waypoints = std::queue wrapping: std::deque with 0 elements, wander_radius = 4, hero_ally = false, summon_power_index = 0, summoner = 0x0, \r\n          requires_status = std::vector of length 0, capacity 0, requires_not_status = std::vector of length 0, capacity 0}\r\n        allies = std::queue wrapping: std::deque with 0 elements\r\n        spawn_pos = {x = 3.11171485e-37, y = 0}\r\n#10 0x000000000055399c in GameStatePlay::checkTeleport (this=0x2b92690) at /home/sylvain/workspace/flare-engine/src/GameStatePlay.cpp:301\r\n        teleport_mapname = \"maps/lab_welcome.txt\"\r\n#11 0x0000000000556cce in GameStatePlay::logic (this=0x2b92690) at /home/sylvain/workspace/flare-engine/src/GameStatePlay.cpp:881\r\nNo locals.\r\n#12 0x000000000055e491 in GameSwitcher::logic (this=0x27a4970) at /home/sylvain/workspace/flare-engine/src/GameSwitcher.cpp:107\r\n        newState = 0x0\r\n#13 0x0000000000632708 in mainLoop () at /home/sylvain/workspace/flare-engine/src/main.cpp:149\r\n        loops = 0\r\n        now_ticks = 44721\r\n        prev_ticks = 44721\r\n        delay_ticks = 14\r\n        done = false\r\n        delay = 17\r\n        logic_ticks = 44714\r\n#14 0x0000000000632f4a in main (argc=1, argv=0x7ffeb664aa78) at /home/sylvain/workspace/flare-engine/src/main.cpp:288\r\n        debug_event = false\r\n        done = false\r\n        render_device_name = \"\"\r\n```"}}