Fixed realloc, should be monitors.

Moved found to the end of the loop, otherwise found = 1 causing index 0 to
crash.

HACK: Retrieve video modes from platform-specific code.
This commit is contained in:
BrandonSchaefer 2014-11-10 09:26:20 -08:00 committed by Camilla Berglund
parent a8b0d1c8e0
commit 0a5d57eade

View File

@ -51,9 +51,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
out->num_modes &&
out->current_mode < out->num_modes)
{
found++;
monitors[found] = realloc(monitors, sizeof(_GLFWmonitor*) * found);
monitors = realloc(monitors, sizeof(_GLFWmonitor*) * found);
monitors[found] = _glfwAllocMonitor("Unknown",
out->physical_width_mm,
out->physical_height_mm);
@ -62,6 +60,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
monitors[found]->mir.y = out->position_y;
monitors[found]->mir.output_id = out->output_id;
monitors[found]->mir.cur_mode = out->current_mode;
monitors[found]->modes = _glfwPlatformGetVideoModes(monitors[found],
&monitors[found]->modeCount);
found++;
}
}