princeamd pushed a commit to branch ecore-1.7.

commit ddff70dcb34093f520999f00ee67631018c68064
Author: Christopher Michael <[email protected]>
Date:   Tue Feb 5 10:51:57 2013 +0000

    Backport: 0c76117 :: 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 <[email protected]>
    
    SVN revision: 83623
    Signed-off-by: Deon Thomas <[email protected]>
---
 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 33c0ffc..bdcf8a0 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))))
                {

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to