forked from enlightenment/efl
ecore-x: fix randr query when noutputs is 0.
This commit is contained in:
parent
a48c4cd064
commit
e945f0d196
|
@ -2672,16 +2672,20 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
|
||||||
|
|
||||||
outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
|
outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
|
||||||
&noutputs);
|
&noutputs);
|
||||||
if (!outputs)
|
if (outputs)
|
||||||
goto _ecore_x_randr_current_output_get_fail_free;
|
{
|
||||||
|
if (noutputs > 0)
|
||||||
|
{
|
||||||
tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
|
tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
|
||||||
if (!tret) goto _ecore_x_randr_current_output_get_fail_free;
|
if (!tret) goto _ecore_x_randr_current_output_get_fail_free;
|
||||||
ret = tret;
|
ret = tret;
|
||||||
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
|
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
|
||||||
nret += noutputs;
|
nret += noutputs;
|
||||||
|
}
|
||||||
free(outputs);
|
free(outputs);
|
||||||
outputs = NULL;
|
outputs = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free(crtcs);
|
free(crtcs);
|
||||||
|
|
||||||
if (num)
|
if (num)
|
||||||
|
|
|
@ -1035,6 +1035,8 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window, int *num)
|
||||||
if (!(crtc = XRRGetCrtcInfo(_ecore_x_disp, res, crtcs[i])))
|
if (!(crtc = XRRGetCrtcInfo(_ecore_x_disp, res, crtcs[i])))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (crtc->noutput > 0)
|
||||||
|
{
|
||||||
/* try to reallocate our return variable */
|
/* try to reallocate our return variable */
|
||||||
if ((tret = realloc(ret, ((nret + crtc->noutput) *
|
if ((tret = realloc(ret, ((nret + crtc->noutput) *
|
||||||
sizeof(Ecore_X_Randr_Output)))))
|
sizeof(Ecore_X_Randr_Output)))))
|
||||||
|
@ -1044,7 +1046,7 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window, int *num)
|
||||||
(crtc->noutput * sizeof(Ecore_X_Randr_Output)));
|
(crtc->noutput * sizeof(Ecore_X_Randr_Output)));
|
||||||
nret += crtc->noutput;
|
nret += crtc->noutput;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* free the crtc info */
|
/* free the crtc info */
|
||||||
XRRFreeCrtcInfo(crtc);
|
XRRFreeCrtcInfo(crtc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue