#496 Windows SDL versions crash when changing drive

v2.4.x
pending-fixed
None
SDL
User Interface
2014-07-10
2014-01-31
querino2
No

hi,

new (no idea since when...) windows SDL dev builds crash when i try to change the drive.

-> F12 -> drive -> attach... -> <choose drive=""> -> BANG! vice is gone.

it also happens for "tape" and "cartridge" too.

all emus are affected.
nothing to find in the vice.log.

Discussion

  • querino2
    querino2
    2014-07-02

    btw, it worked in 2.4.3, but not anymore in 2.4.5

    2.4.4 i couldn't compile.

     
  • Greg King
    Greg King
    2014-07-05

    (A Markdown formatting bug hid a step.) The sequence is
    F12 -> Drive -> Attach ... -> <choose drive>

    All of the file-selection submenues have a "<choose drive>" line. The "segmentation fault" crash happens because the function that builds the list of drive names doesn't terminate that list properly. The Amiga SDL port has the same bug. Here are patches:

    Index: src/arch/sdl/archdep_amiga.c
    ===================================================================
    --- src/arch/sdl/archdep_amiga.c    (revision 28095)
    +++ src/arch/sdl/archdep_amiga.c    (working copy)
    @@ -419,10 +419,10 @@ void archdep_shutdown_extra(void)
    
     static int CountEntries(void)
     {
    -    int entries = 0;
    +    int entries = 1;
         struct DosList *dl = LockDosList(LF);
    
    -    while (dl = NextDosEntry(dl, LF) {
    +    while (dl = NextDosEntry(dl, LF)) {
             entries++;
         }
         UnlockDosList(LF);
    @@ -433,7 +433,6 @@ static int CountEntries(void)
     char **archdep_list_drives(void)
     {
         int drive_count = CountEntries();
    -    int i = 0;
         char **result, **p;
         struct DosList *dl = LockDosList(LF);
    
    @@ -442,9 +441,8 @@ char **archdep_list_drives(void)
    
         while (dl = NextDosEntry(dl, LF)) {
             *p++ = lib_stralloc(BADDR(dl->dol_Name));
    -        ++i;
         }
    -    result[i] = NULL;
    +    *p = NULL;
    
         UnlockDosList(LF);
    
    Index: src/arch/sdl/archdep_win32.c
    ===================================================================
    --- src/arch/sdl/archdep_win32.c    (revision 28095)
    +++ src/arch/sdl/archdep_win32.c    (working copy)
    @@ -574,7 +574,7 @@ char **archdep_list_drives(void)
             mask <<= 1;
             ++i;
         }
    -    result[i] = NULL;
    +    *p = NULL;
    
         return result;
     }
    
     
  • Patch applied in rev 28096, thanks for the patch.

     
    • status: open --> pending-fixed
     
  • querino2
    querino2
    2014-07-06

    thnx a lot mr. king!

    it does work. however, if a drive isn't accessible, there's no error message, simply nothing happens.
    but this isn't something new and also nothing serious, it also happens on the last stable version 2.4

    great, this was annoying.

     
  • querino2
    querino2
    2014-07-10

    still something is weird here, windows SDL x64 build.

    when i select "choose drive" and after that immediately go back using the left arrow key, the emu crashes.

    Problemereignisname: APPCRASH
    Anwendungsname: x64.exe
    Anwendungsversion: 0.0.0.0
    Anwendungszeitstempel: 7aaaf1c2
    Fehlermodulname: StackHash_1391
    Fehlermodulversion: 6.1.7601.18247
    Ausnahmecode: c0000374

    though this does NOT happen in the x86 version.

    /edit:
    i checked the last stable windows SDL x64 version 2.4, and this happens there too...

     
    Last edit: querino2 2014-07-10