From 0c76117e1e7f39d268b0b5fa46417f3981681fec Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 5 Feb 2013 10:51:57 +0000 Subject: [PATCH] Be a bit more pedantic when getting outputs for a crtc, in that if xrandr returns 0 outputs, then free resources and return null quickly. Signed-off-by: Christopher Michael SVN revision: 83623 --- src/lib/ecore_x/xlib/ecore_x_randr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c b/src/lib/ecore_x/xlib/ecore_x_randr.c index 33c0ffc95d..bdcf8a00e0 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr.c @@ -1135,6 +1135,18 @@ ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int /* try to get crtc info */ if ((info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) { + /* if we have no outputs, return NULL */ + if (info->noutput == 0) + { + /* free the crtc info */ + XRRFreeCrtcInfo(info); + + /* free the resources */ + XRRFreeScreenResources(res); + + return NULL; + } + /* try to allocate our return struct */ if ((ret = malloc(info->noutput * sizeof(Ecore_X_Randr_Output)))) {