Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when quitting debug version #7

Closed
Szunti opened this issue May 22, 2015 · 7 comments
Closed

Segmentation fault when quitting debug version #7

Szunti opened this issue May 22, 2015 · 7 comments

Comments

@Szunti
Copy link
Contributor

Szunti commented May 22, 2015

It happens even when I immediately quit from the menu.

Backtrace:

#0  0x0000000000000141 in ?? ()
#1  0x00000000006eaaa4 in CUnitType::~CUnitType (this=0x44ac470, 
    __in_chrg=<optimized out>)
    at Wyrmgus/src/unit/unittype.cpp:684
#2  0x00000000006ed71b in CleanUnitTypes ()
    at Wyrmgus/src/unit/unittype.cpp:1530
#3  0x00000000005c0e04 in CleanModules ()
    at Wyrmgus/src/game/loadgame.cpp:94
#4  0x0000000000674e7b in Exit (err=0)
    at Wyrmgus/src/stratagus/stratagus.cpp:414
#5  0x000000000067566b in stratagusMain (argc=3, argv=0x7fffffffe798)
    at Wyrmgus/src/stratagus/stratagus.cpp:782
#6  0x00000000006563d6 in main (argc=3, argv=0x7fffffffe798)
    at Wyrmgus/src/stratagus/main.cpp:37

It's deleting a CBuildRestrictionDistance of the dwarven hall. I thought that the vtable of the CBuildRestrcitionDistance is corrupted. I don't even understand why gdb sais there is only one BuildingRules entry, when there are 4 restrictions in Wyrmsun/scripts/units.lua: unit-template-town-hall

@Andrettin
Copy link
Owner

I think I found what caused the problem - when building rules are parsed, new CBuildRestrictionDistance and etc. instances are created, and when the building rules are copied to the unit types that have the unit-template-town-hall set as their "parent" unit type, they still refer to the old instances. So when the game exits, it deletes the unit-template-town-hall unit type (along with its BuildingRules' CBuildRestrictionDistance instances), so that when its "child" units try to access it, those CBuildRestrictionDistance instances have already been deleted.

@Andrettin
Copy link
Owner

Should be fixed with the latest commit of Wyrmsun and Wyrmgus, let me know if you still experience it.

@Szunti
Copy link
Contributor Author

Szunti commented May 27, 2015

Different, but still bad:

*** Error in ./stratagus-dbg': corrupted double-linked list: 0x00000000057ac620 ***`

Backtrace:

#0  0x00007fdc9c4460eb in __lll_lock_wait_private ()
   from /usr/lib/libc.so.6
#1  0x00007fdc9c3cc8ac in malloc () from /usr/lib/libc.so.6
#2  0x00007fdc9d4eea86 in ?? () from /usr/lib/libX11.so.6
#3  0x00007fdc9d4ef6a8 in _XReply () from /usr/lib/libX11.so.6
#4  0x00007fdc9d4eb11d in XSync () from /usr/lib/libX11.so.6
#5  0x00007fdc9ea6b928 in ?? () from /usr/lib/libSDL-1.2.so.0
#6  0x00007fdc9ea5bf4e in SDL_VideoQuit () from /usr/lib/libSDL-1.2.so.0
#7  0x00007fdc9ea35e45 in SDL_QuitSubSystem ()
   from /usr/lib/libSDL-1.2.so.0
#8  0x00007fdc9ea35eee in SDL_Quit () from /usr/lib/libSDL-1.2.so.0
#9  0x000000000071c408 in CleanExit ()
    at Wyrmgus/src/video/sdl.cpp:345
#10 <signal handler called>
#11 0x00007fdc9c385528 in raise () from /usr/lib/libc.so.6
#12 0x00007fdc9c38693a in abort () from /usr/lib/libc.so.6
#13 0x00007fdc9c3c3bb2 in __libc_message () from /usr/lib/libc.so.6
#14 0x00007fdc9c3c90fe in malloc_printerr () from /usr/lib/libc.so.6
#15 0x00007fdc9c3c93c6 in malloc_consolidate () from /usr/lib/libc.so.6
#16 0x00007fdc9c3c9f30 in _int_free () from /usr/lib/libc.so.6
#17 0x00007fdc9d517643 in _XimLocalIMFree () from /usr/lib/libX11.so.6
#18 0x00007fdc9d5178b4 in ?? () from /usr/lib/libX11.so.6
#19 0x00007fdc9d4fc920 in XCloseIM () from /usr/lib/libX11.so.6
#20 0x00007fdc9ea6b971 in ?? () from /usr/lib/libSDL-1.2.so.0
#21 0x00007fdc9ea5bf4e in SDL_VideoQuit () from /usr/lib/libSDL-1.2.so.0
#22 0x00007fdc9ea35e45 in SDL_QuitSubSystem ()
   from /usr/lib/libSDL-1.2.so.0
#23 0x00007fdc9ea35eee in SDL_Quit () from /usr/lib/libSDL-1.2.so.0
#24 0x000000000071c408 in CleanExit ()
    at Wyrmgus/src/video/sdl.cpp:345
#25 <signal handler called>
#26 0x00007fdc9c385528 in raise () from /usr/lib/libc.so.6
#27 0x00007fdc9c38693a in abort () from /usr/lib/libc.so.6
#28 0x00007fdc9c3c3bb2 in __libc_message () from /usr/lib/libc.so.6
#29 0x00007fdc9c3c90fe in malloc_printerr () from /usr/lib/libc.so.6
#30 0x00007fdc9c3c98db in _int_free () from /usr/lib/libc.so.6
#31 0x00000000006f371b in CUnitType::~CUnitType (this=0x5adff50, 
    __in_chrg=<optimized out>)
    at Wyrmgus/src/unit/unittype.cpp:734
#32 0x00000000006f5fad in CleanUnitTypes ()
    at Wyrmgus/src/unit/unittype.cpp:1533
#33 0x00000000005c6823 in CleanModules ()
    at Wyrmgus/src/game/loadgame.cpp:94
#34 0x000000000067c124 in Exit (err=0)
    at Wyrmgus/src/stratagus/stratagus.cpp:414
#35 0x000000000067c926 in stratagusMain (argc=3, argv=0x7fffc2c97f98)
    at Wyrmgus/src/stratagus/stratagus.cpp:782
#36 0x000000000065d018 in main (argc=3, argv=0x7fffc2c97f98)
    at Wyrmgus/src/stratagus/main.cpp:37

@Szunti
Copy link
Contributor Author

Szunti commented May 27, 2015

Forgot that I just quit from the menu after it showed up

@Szunti
Copy link
Contributor Author

Szunti commented May 27, 2015

With 6b69969 it seems to be fixed.
Can this be the cause for #11 too?

@Andrettin
Copy link
Owner

Thanks! Different bug, yes, but same principle: "child" unit types inheriting references from their "parent", instead of a variable, causing a problem when deleting them.

Should be fixed with commit 237, let me know if the bug persists or you get another crash.

@Andrettin
Copy link
Owner

It could be the cause for that, but I don't see what would be the relationship. I would leave that issue open, and see if you experience that bug again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants