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