From d300aa3255301ce4a22407443d68b1339d94789a Mon Sep 17 00:00:00 2001 From: BrandonSchaefer Date: Mon, 10 Nov 2014 12:12:03 -0800 Subject: [PATCH] Fix the found issue. Found needs to be 1. This is needed for realloc, while index should be 0. So using i for the index, and found for the count. --- src/mir_monitor.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mir_monitor.c b/src/mir_monitor.c index 286975d3..bdf47bdc 100644 --- a/src/mir_monitor.c +++ b/src/mir_monitor.c @@ -51,20 +51,19 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) out->num_modes && out->current_mode < out->num_modes) { + found++; monitors = realloc(monitors, sizeof(_GLFWmonitor*) * found); - monitors[found] = _glfwAllocMonitor("Unknown", + monitors[i] = _glfwAllocMonitor("Unknown", out->physical_width_mm, out->physical_height_mm); - monitors[found]->mir.x = out->position_x; - monitors[found]->mir.y = out->position_y; - monitors[found]->mir.output_id = out->output_id; - monitors[found]->mir.cur_mode = out->current_mode; + monitors[i]->mir.x = out->position_x; + monitors[i]->mir.y = out->position_y; + monitors[i]->mir.output_id = out->output_id; + monitors[i]->mir.cur_mode = out->current_mode; - monitors[found]->modes = _glfwPlatformGetVideoModes(monitors[found], - &monitors[found]->modeCount); - - found++; + monitors[i]->modes = _glfwPlatformGetVideoModes(monitors[i], + &monitors[i]->modeCount); } }