dgcor / DGEngine

An implementation of the Diablo 1 game engine
Other
243 stars 30 forks source link

Crash when walking on dungeon level 1 #14

Closed mewmew closed 6 years ago

mewmew commented 7 years ago

core dump

on revision 4df29d19e51bc5fb331abaa51377063f6f863cc4

https://media.giphy.com/media/l4FGIY0BFuqi7i8UM/giphy.gif

           PID: 28778 (DGEngine)
           UID: 1000 (u)
           GID: 100 (users)
        Signal: 11 (SEGV)
     Timestamp: Wed 2017-04-26 21:53:54 CEST (39s ago)
  Command Line: ./DGEngine gamefiles/
    Executable: /home/u/Desktop/diablo/DGEngine/DGEngine
 Control Group: /user.slice/user-1000.slice/session-c1.scope
          Unit: session-c1.scope
         Slice: user-1000.slice
       Session: c1
     Owner UID: 1000 (u)
       Boot ID: 800fc8d91bef42cfb8c89618ac4cd02c
    Machine ID: 28a33732c4064f1791505da65cf095d5
      Hostname: x220
       Storage: /var/lib/systemd/coredump/core.DGEngine.1000.800fc8d91bef42cfb8c89618ac4cd02c.28778.1493236434000000000000.lz4
       Message: Process 28778 (DGEngine) of user 1000 dumped core.

                Stack trace of thread 28778:
                #0  0x0000000000812cc5 _ZN20ActPlayerMoveToClick7executeER4Game (DGEngine)
                #1  0x0000000000891325 _ZN14ActIfCondition11ifConditionER4Gameb (DGEngine)
                #2  0x00000000008914bd _ZN14ActIfCondition7executeER4Game (DGEngine)
                #3  0x0000000000777c27 _ZN5Event6updateER4Game (DGEngine)
                #4  0x000000000077ed09 _ZN12EventManager6updateER4Game (DGEngine)
                #5  0x000000000077c2ea _ZN4Game12updateEventsEv (DGEngine)
                #6  0x000000000077b756 _ZN4Game4playEv (DGEngine)
                #7  0x0000000000759e58 main (DGEngine)
                #8  0x00007fc6cc45d511 __libc_start_main (libc.so.6)
                #9  0x00000000007599ea _start (DGEngine)

                Stack trace of thread 28783:
                #0  0x00007fc6cc015756 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007fc6bf7cb4c8 pa_threaded_mainloop_wait (libpulse.so.0)
                #2  0x00007fc6caea8429 n/a (libopenal.so.1)
                #3  0x00007fc6caead6c7 n/a (libopenal.so.1)
                #4  0x00007fc6cc00f2e7 start_thread (libpthread.so.0)
                #5  0x00007fc6cc52954f __clone (libc.so.6)

                Stack trace of thread 28782:
                #0  0x00007fc6cc51f67d poll (libc.so.6)
                #1  0x00007fc6bf7caee1 n/a (libpulse.so.0)
                #2  0x00007fc6bf7bc6f1 pa_mainloop_poll (libpulse.so.0)
                #3  0x00007fc6bf7bcd8e pa_mainloop_iterate (libpulse.so.0)
                #4  0x00007fc6bf7bce40 pa_mainloop_run (libpulse.so.0)
                #5  0x00007fc6bf7cae29 n/a (libpulse.so.0)
                #6  0x00007fc6bf568fe8 n/a (libpulsecommon-10.0.so)
                #7  0x00007fc6cc00f2e7 start_thread (libpthread.so.0)
                #8  0x00007fc6cc52954f __clone (libc.so.6)

                Stack trace of thread 28794:
                #0  0x00007fc6cc4f742d __nanosleep (libc.so.6)
                #1  0x00007fc6cd949190 n/a (libsfml-system.so.2.4)
                #2  0x00007fc6cd0a2063 _ZN2sf11SoundStream10streamDataEv (libsfml-audio.so.2.4)
                #3  0x00007fc6cd9491e8 n/a (libsfml-system.so.2.4)
                #4  0x00007fc6cc00f2e7 start_thread (libpthread.so.0)
                #5  0x00007fc6cc52954f __clone (libc.so.6)

GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/u/Desktop/diablo/DGEngine/DGEngine...(no debugging symbols found)...done.
[New LWP 28778]
[New LWP 28783]
[New LWP 28782]
[New LWP 28794]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `./DGEngine gamefiles/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000812cc5 in ActPlayerMoveToClick::execute(Game&) ()
[Current thread is 1 (Thread 0x7fc6cdf3a740 (LWP 28778))]
(gdb) bt
#0  0x0000000000812cc5 in ActPlayerMoveToClick::execute(Game&) ()
#1  0x0000000000891325 in ActIfCondition::ifCondition(Game&, bool) ()
#2  0x00000000008914bd in ActIfCondition::execute(Game&) ()
#3  0x0000000000777c27 in Event::update(Game&) ()
#4  0x000000000077ed09 in EventManager::update(Game&) ()
#5  0x000000000077c2ea in Game::updateEvents() ()
#6  0x000000000077b756 in Game::play() ()
#7  0x0000000000759e58 in main ()
ghost commented 7 years ago

Thank you for reporting this. The crash is because of a missing cleanup of the current hovered level object when loading a new level. If you load level 1 again and try not to have you mouse over any level object in town, it won't crash when walking on level 1.

To fix this, add the last line to this function in Level.cpp

void Level::Init(const LevelMap& map_, Min& min_, CelFrameCache& cel_)
{
    map = map_;
    currentMapPosition = MapCoord(map.Width() / 2, map.Height() / 2);
    tiles = LevelHelper::loadTilesetSprite(cel_, min_, false);
    tiles2 = LevelHelper::loadTilesetSprite(cel_, min_, true);
    hoverObject = nullptr;    // add this to fix crash
}

If you now load a level and have the mouse hovering the "door" object, it will no longer crash when walking on level 1.

Edit: Fixed on the last commit 1a022c6.

sskras commented 6 years ago

So can the report be closed?

mewmew commented 6 years ago

@sskras The report can be closed indeed. This has been fixed. Now I'm stuck on another crash #16.