forked from enlightenment/efl
fix randr segv's waiting to happen. bad mem managment :(
SVN revision: 70951
This commit is contained in:
parent
b0907e89b8
commit
262e8118b7
|
@ -640,3 +640,8 @@
|
||||||
2012-05-10 Jiyoun Park
|
2012-05-10 Jiyoun Park
|
||||||
|
|
||||||
* Send mouse move event before mouse down event in ecore_extn
|
* Send mouse move event before mouse down event in ecore_extn
|
||||||
|
|
||||||
|
2012-05-13 Carsten Haitzler (The Rasterman)
|
||||||
|
|
||||||
|
* Fix ecore-x randr issues with memory access when building
|
||||||
|
output arrays which are memory segv bugs waiting to crash.
|
||||||
|
|
|
@ -1628,7 +1628,7 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
|
||||||
|
|
||||||
root = ecore_x_window_root_get(window);
|
root = ecore_x_window_root_get(window);
|
||||||
crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
|
crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
|
||||||
if (!crtcs) return NULL;
|
if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail;
|
||||||
|
|
||||||
/* now get window RELATIVE to root window - thats what matters. */
|
/* now get window RELATIVE to root window - thats what matters. */
|
||||||
cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
|
cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
|
||||||
|
@ -1637,6 +1637,12 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
|
||||||
w_geo.y = trans->dst_y;
|
w_geo.y = trans->dst_y;
|
||||||
free(trans);
|
free(trans);
|
||||||
|
|
||||||
|
ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc));
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
free(crtcs);
|
||||||
|
goto _ecore_x_randr_window_crtcs_get_fail;
|
||||||
|
}
|
||||||
for (i = 0, nret = 0; i < ncrtcs; i++)
|
for (i = 0, nret = 0; i < ncrtcs; i++)
|
||||||
{
|
{
|
||||||
/* if crtc is not enabled, don't bother about it any further */
|
/* if crtc is not enabled, don't bother about it any further */
|
||||||
|
@ -1647,9 +1653,8 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
|
||||||
&c_geo.w, &c_geo.h);
|
&c_geo.w, &c_geo.h);
|
||||||
if (eina_rectangles_intersect(&w_geo, &c_geo))
|
if (eina_rectangles_intersect(&w_geo, &c_geo))
|
||||||
{
|
{
|
||||||
ret = realloc(ret, (++nret *
|
|
||||||
sizeof(Ecore_X_Randr_Output)));
|
|
||||||
ret[nret] = crtcs[i];
|
ret[nret] = crtcs[i];
|
||||||
|
nret++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(crtcs);
|
free(crtcs);
|
||||||
|
@ -1657,6 +1662,7 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
|
||||||
if (num) *num = nret;
|
if (num) *num = nret;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
_ecore_x_randr_window_crtcs_get_fail:
|
||||||
#endif
|
#endif
|
||||||
if (num) *num = 0;
|
if (num) *num = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2442,7 +2448,7 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
|
||||||
#ifdef ECORE_XCB_RANDR
|
#ifdef ECORE_XCB_RANDR
|
||||||
Ecore_X_Window root;
|
Ecore_X_Window root;
|
||||||
Ecore_X_Randr_Crtc *crtcs;
|
Ecore_X_Randr_Crtc *crtcs;
|
||||||
Ecore_X_Randr_Output *outputs, *ret = NULL;
|
Ecore_X_Randr_Output *outputs, *ret = NULL, *tret;
|
||||||
int ncrtcs, noutputs, i, nret = 0;
|
int ncrtcs, noutputs, i, nret = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2465,10 +2471,13 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
|
||||||
&noutputs);
|
&noutputs);
|
||||||
if (!outputs)
|
if (!outputs)
|
||||||
goto _ecore_x_randr_current_output_get_fail_free;
|
goto _ecore_x_randr_current_output_get_fail_free;
|
||||||
nret += noutputs;
|
tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
|
||||||
ret = realloc(ret, (nret * 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)));
|
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
|
||||||
|
nret += noutputs;
|
||||||
free(outputs);
|
free(outputs);
|
||||||
|
outputs = NULL;
|
||||||
}
|
}
|
||||||
free(crtcs);
|
free(crtcs);
|
||||||
|
|
||||||
|
|
|
@ -596,6 +596,12 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
|
||||||
w_geo.x = rx;
|
w_geo.x = rx;
|
||||||
w_geo.y = ry;
|
w_geo.y = ry;
|
||||||
|
|
||||||
|
ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc));
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
free(crtcs);
|
||||||
|
goto _ecore_x_randr_window_crtcs_get_fail;
|
||||||
|
}
|
||||||
for (i = 0, nret = 0; i < ncrtcs; i++)
|
for (i = 0, nret = 0; i < ncrtcs; i++)
|
||||||
{
|
{
|
||||||
/* if crtc is not enabled, don't bother about it any further */
|
/* if crtc is not enabled, don't bother about it any further */
|
||||||
|
@ -607,8 +613,8 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
|
||||||
&c_geo.w, &c_geo.h);
|
&c_geo.w, &c_geo.h);
|
||||||
if (eina_rectangles_intersect(&w_geo, &c_geo))
|
if (eina_rectangles_intersect(&w_geo, &c_geo))
|
||||||
{
|
{
|
||||||
ret = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret));
|
|
||||||
ret[nret] = crtcs[i];
|
ret[nret] = crtcs[i];
|
||||||
|
nret++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(crtcs);
|
free(crtcs);
|
||||||
|
@ -2337,7 +2343,7 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
|
||||||
#ifdef ECORE_XRANDR
|
#ifdef ECORE_XRANDR
|
||||||
Ecore_X_Window root;
|
Ecore_X_Window root;
|
||||||
Ecore_X_Randr_Crtc *crtcs;
|
Ecore_X_Randr_Crtc *crtcs;
|
||||||
Ecore_X_Randr_Output *outputs, *ret = NULL;
|
Ecore_X_Randr_Output *outputs, *ret = NULL, *tret;
|
||||||
int ncrtcs, noutputs, i, nret = 0;
|
int ncrtcs, noutputs, i, nret = 0;
|
||||||
|
|
||||||
if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
|
if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
|
||||||
|
@ -2345,18 +2351,21 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
|
||||||
root = ecore_x_window_root_get(window);
|
root = ecore_x_window_root_get(window);
|
||||||
if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
|
if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
|
||||||
goto _ecore_x_randr_current_output_get_fail;
|
goto _ecore_x_randr_current_output_get_fail;
|
||||||
|
|
||||||
for (i = 0, nret = 0; i < ncrtcs; i++)
|
for (i = 0, nret = 0; i < ncrtcs; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
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;
|
goto _ecore_x_randr_current_output_get_fail_free;
|
||||||
nret += noutputs;
|
tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
|
||||||
ret = realloc(ret, (nret * 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)));
|
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
|
||||||
|
nret += noutputs;
|
||||||
free(outputs);
|
free(outputs);
|
||||||
|
outputs = NULL;
|
||||||
}
|
}
|
||||||
free(crtcs);
|
free(crtcs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue