Secretchronicles / TSC

An open source two-dimensional platform game.
https://secretchronicles.org/
GNU General Public License v3.0
205 stars 49 forks source link

Game Crashes Sometimes on Game Save #687

Closed datahead8888 closed 4 years ago

datahead8888 commented 4 years ago

I've found that after flipping a switch then saving, the game sometimes crashes. Switches may or may not be related to the problem.

This is what I generally did:

I reproduced this in gdb. It usually does not happen but sometimes does. Here is the stack trace and other console output:

[New Thread 0x7fffc1e65700 (LWP 2020)]
Showing invisible world 'Test 1' because this is a debug build.
Showing invisible world 'World 2' because this is a debug build.
Showing invisible world 'World 3' because this is a debug build.
Showing invisible world 'World 4' because this is a debug build.
Loading savegame file '/home/chris/.local/share/tsc/savegames/1.tscsav'
Loading savegame file '/home/chris/.local/share/tsc/savegames/1.tscsav'
Loading savegame file '/home/chris/.local/share/tsc/savegames/1.tscsav'
CEGUI::AlreadyExistsException in function 'virtual void CEGUI::NamedElement::addChild_impl(CEGUI::Element*)' (/build/cegui-mk2-9DBjsE/cegui-mk2-0.8.7/cegui/src/NamedElement.cpp:185) : Failed to add Element named: box_text_window to element at: root since an Element with that name is already attached.
terminate called after throwing an instance of 'CEGUI::AlreadyExistsException'
  what():  CEGUI::AlreadyExistsException in function 'virtual void CEGUI::NamedElement::addChild_impl(CEGUI::Element*)' (/build/cegui-mk2-9DBjsE/cegui-mk2-0.8.7/cegui/src/NamedElement.cpp:185) : Failed to add Element named: box_text_window to element at: root since an Element with that name is already attached.

Thread 1 "tsc" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff442ce97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff442e801 in __GI_abort () at abort.c:79
#2  0x00007ffff4e21957 in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff4e27ae6 in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff4e27b21 in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff4e27d54 in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff76ecdac in CEGUI::NamedElement::addChild_impl(CEGUI::Element*) () at /usr/lib/libCEGUIBase-0.so.2
#7  0x00007ffff7734d1d in CEGUI::Window::addChild_impl(CEGUI::Element*) () at /usr/lib/libCEGUIBase-0.so.2
#8  0x00007ffff76b06c0 in CEGUI::Element::addChild(CEGUI::Element*) () at /usr/lib/libCEGUIBase-0.so.2
#9  0x000055555575a343 in TSC::cDialogBox::Init() (this=0x5555635f4340) at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/generic.cpp:49
#10 0x000055555575a5b6 in TSC::cDialogBox_Text::Init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (this=0x5555635f4340, title_text="Enter Description") at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/generic.cpp:100
#11 0x000055555575a80b in TSC::cDialogBox_Text::Enter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (this=0x5555635f4340, default_text="Switch", title_text="Enter Description", auto_no_text=false)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/generic.cpp:115
#12 0x000055555575bfe4 in TSC::Box_Text_Input(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (default_text="Switch", title_text="Enter Description", auto_no_text=false)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/generic.cpp:418
#13 0x00005555557801f1 in TSC::cMenu_Savegames::Set_Save_Description[abi:cxx11](unsigned int) (this=0x555564084850, save_slot=1)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/menu_data.cpp:3294
#14 0x000055555577fad8 in TSC::cMenu_Savegames::Button_Save_Clicked(CEGUI::EventArgs const&) (this=0x555564084850, event=...)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/menu_data.cpp:3195
#15 0x00005555557874c4 in CEGUI::MemberFunctionSlot<TSC::cMenu_Savegames>::operator()(CEGUI::EventArgs const&) (this=0x5555639a09a0, args=...)
    at /usr/include/cegui-0.8.7/CEGUI/MemberFunctionSlot.h:54
#16 0x00007ffff76bdaec in CEGUI::Event::operator()(CEGUI::EventArgs&) () at /usr/lib/libCEGUIBase-0.so.2
#17 0x00007ffff77c4e8f in CEGUI::PushButton::onMouseButtonUp(CEGUI::MouseEventArgs&) () at /usr/lib/libCEGUIBase-0.so.2
#18 0x00007ffff76d558a in CEGUI::GUIContext::injectMouseButtonUp(CEGUI::MouseButton) () at /usr/lib/libCEGUIBase-0.so.2
#19 0x000055555578b007 in TSC::cMouseCursor::Handle_Mouse_Up(sf::Mouse::Button) (this=0x55555735b5c0, button=sf::Mouse::Left)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/input/mouse.cpp:269
#20 0x000055555578ad4c in TSC::cMouseCursor::Handle_Event(sf::Event const&) (this=0x55555735b5c0, ev=...) at /home/chris/OpenSource/TSC/TSC/tsc/src/input/mouse.cpp:160
#21 0x000055555575aad3 in TSC::cDialogBox_Text::Enter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (this=0x5555637c6d90, default_text="Switch", title_text="Enter Description", auto_no_text=false)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/generic.cpp:151
#22 0x000055555575bfe4 in TSC::Box_Text_Input(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (default_text="Switch", title_text="Enter Description", auto_no_text=false)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/generic.cpp:418
#23 0x00005555557801f1 in TSC::cMenu_Savegames::Set_Save_Description[abi:cxx11](unsigned int) (this=0x555564084850, save_slot=1)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/menu_data.cpp:3294
#24 0x000055555577fad8 in TSC::cMenu_Savegames::Button_Save_Clicked(CEGUI::EventArgs const&) (this=0x555564084850, event=...)
---Type <return> to continue, or q <return> to quit---
    at /home/chris/OpenSource/TSC/TSC/tsc/src/gui/menu_data.cpp:3195
#25 0x00005555557874c4 in CEGUI::MemberFunctionSlot<TSC::cMenu_Savegames>::operator()(CEGUI::EventArgs const&) (this=0x5555639a09a0, args=...)
    at /usr/include/cegui-0.8.7/CEGUI/MemberFunctionSlot.h:54
#26 0x00007ffff76bdaec in CEGUI::Event::operator()(CEGUI::EventArgs&) () at /usr/lib/libCEGUIBase-0.so.2
#27 0x00007ffff77c4e8f in CEGUI::PushButton::onMouseButtonUp(CEGUI::MouseEventArgs&) () at /usr/lib/libCEGUIBase-0.so.2
#28 0x00007ffff76d558a in CEGUI::GUIContext::injectMouseButtonUp(CEGUI::MouseButton) () at /usr/lib/libCEGUIBase-0.so.2
#29 0x000055555578b007 in TSC::cMouseCursor::Handle_Mouse_Up(sf::Mouse::Button) (this=0x55555735b5c0, button=sf::Mouse::Left)
    at /home/chris/OpenSource/TSC/TSC/tsc/src/input/mouse.cpp:269
#30 0x000055555578ad4c in TSC::cMouseCursor::Handle_Event(sf::Event const&) (this=0x55555735b5c0, ev=...) at /home/chris/OpenSource/TSC/TSC/tsc/src/input/mouse.cpp:160
#31 0x0000555555706359 in TSC::Handle_Input_Global(sf::Event const&) (ev=...) at /home/chris/OpenSource/TSC/TSC/tsc/src/core/main.cpp:553
#32 0x000055555570646a in TSC::Update_Game() () at /home/chris/OpenSource/TSC/TSC/tsc/src/core/main.cpp:598
#33 0x0000555555704f71 in main(int, char**) (argc=1, argv=0x7fffffffdf38) at /home/chris/OpenSource/TSC/TSC/tsc/src/core/main.cpp:202
datahead8888 commented 4 years ago

I nailed the steps.

Exact steps to reproduce:

datahead8888 commented 4 years ago

Thanks for fixing this at the last minute. I appreciate your diligence in knocking out issues as I kept finding them.