From 0a5d57eade7e236c9dbff52defc051f61e58ff2a Mon Sep 17 00:00:00 2001 From: BrandonSchaefer Date: Mon, 10 Nov 2014 09:26:20 -0800 Subject: [PATCH] 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. --- src/mir_monitor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mir_monitor.c b/src/mir_monitor.c index 5fb73ef5..286975d3 100644 --- a/src/mir_monitor.c +++ b/src/mir_monitor.c @@ -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++; } }