[haiku-commits] r42438 - haiku/trunk/src/add-ons/accelerants/vesa

  • From: bga@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 16 Jul 2011 15:59:07 +0200 (CEST)

Author: bga
Date: 2011-07-16 15:59:06 +0200 (Sat, 16 Jul 2011)
New Revision: 42438
Changeset: https://dev.haiku-os.org/changeset/42438

Modified:
   haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp
Log:
Fix crash in VESA accelerant.

- Keep track of the correct number of initial modes available.



Modified: haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp
===================================================================
--- haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp   2011-07-16 12:57:14 UTC 
(rev 42437)
+++ haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp   2011-07-16 13:59:06 UTC 
(rev 42438)
@@ -79,10 +79,12 @@
        // Create the initial list from the support mode list - but only if we 
don't
        // have EDID info available, as that should be good enough.
        display_mode* initialModes = NULL;
+       uint32 initialModesCount = 0;
        if (!gInfo->shared_info->has_edid) {
                initialModes = (display_mode*)malloc(
                        sizeof(display_mode) * 
gInfo->shared_info->vesa_mode_count);
                if (initialModes != NULL) {
+                       initialModesCount = gInfo->shared_info->vesa_mode_count;
                        vesa_mode* vesaModes = gInfo->vesa_modes;
 
                        for (uint32 i = gInfo->shared_info->vesa_mode_count; 
i-- > 0;) {
@@ -95,7 +97,7 @@
 
        gInfo->mode_list_area = create_display_modes("vesa modes",
                gInfo->shared_info->has_edid ? &gInfo->shared_info->edid_info : 
NULL,
-               initialModes, gInfo->shared_info->vesa_mode_count,
+               initialModes, initialModesCount,
                kVesaSpaces, sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]),
                is_mode_supported, &gInfo->mode_list, 
&gInfo->shared_info->mode_count);
 


Other related posts: