[AD] Fix for mode selector

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi,

Here is a fix for the mode selector. When there is an autodetection
function for a graphics driver, but the call to the function fails, the
mode selector still tries to free the memory used by the mode list
(which is of course the default mode list). This causes a crash.

This problem surfaced on one of my DJGPP systems and not the other since
one of them does support VESA 3.0 and the other doesn't; since there is
an autodetection function for VESA 3.0 modes, which returns an error on
the second system, the crash surfaces.

This crash may therefore also affect a significant number of other
systems. The fix is quite a simple one-liner, and I include it here:
--- /home/cvs/libs/allegro/src/modesel.c	Tue Sep 11 17:53:26 2001
+++ modesel.c	Wed Sep 19 12:57:24 2001
@@ -263,6 +263,7 @@
    else {
       driver_list_entry->mode_count = sizeof(default_mode_list) / sizeof(MODE_LIST) - 1;
       driver_list_entry->mode_list = default_mode_list;
+      driver_list_entry->fetch_mode_list_ptr = 0;
    }
 
    destroy_gfx_mode_list();
Hopefully this solves the problem once and for all.

Bye for now,
-- 
Laurence Withers, lwithers@xxxxxxxxxx
                http://www.lwithers.demon.co.uk/

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/