gl_x11/evas_engine: Prevent dereference before NULL check

Summary: re->win pointer was not compared with NULL pointer before re->win was referenced.

Reviewers: Hermet

Reviewed By: Hermet

CC: seoz, cedric

Differential Revision: https://phab.enlightenment.org/D910
This commit is contained in:
Jaehyun Cho 2014-05-28 14:32:39 +09:00 committed by ChunEon Park
parent bc446e37c1
commit abbfd23a22
1 changed files with 9 additions and 12 deletions

View File

@ -929,7 +929,7 @@ eng_setup(Evas *eo_e, void *in)
else else
{ {
re = e->engine.data.output; re = e->engine.data.output;
if (_re_wincheck(re)) if (re->win && _re_wincheck(re))
{ {
if ((re->info->info.display != re->win->disp) || if ((re->info->info.display != re->win->disp) ||
(re->info->info.drawable != re->win->win) || (re->info->info.drawable != re->win->win) ||
@ -939,15 +939,10 @@ eng_setup(Evas *eo_e, void *in)
(re->info->info.depth != re->win->depth) || (re->info->info.depth != re->win->depth) ||
(re->info->info.destination_alpha != re->win->alpha)) (re->info->info.destination_alpha != re->win->alpha))
{ {
int inc = 0; re->win->gl_context->references++;
eng_window_free(re->win);
gl_wins--;
if (re->win)
{
re->win->gl_context->references++;
eng_window_free(re->win);
inc = 1;
gl_wins--;
}
re->w = e->output.w; re->w = e->output.w;
re->h = e->output.h; re->h = e->output.h;
re->win = eng_window_new(re->info->info.display, re->win = eng_window_new(re->info->info.display,
@ -962,9 +957,11 @@ eng_setup(Evas *eo_e, void *in)
re->info->info.destination_alpha, re->info->info.destination_alpha,
re->info->info.rotation); re->info->info.rotation);
eng_window_use(re->win); eng_window_use(re->win);
if (re->win) gl_wins++; if (re->win)
if ((re->win) && (inc)) {
re->win->gl_context->references--; gl_wins++;
re->win->gl_context->references--;
}
} }
else if ((re->win->w != e->output.w) || else if ((re->win->w != e->output.w) ||
(re->win->h != e->output.h) || (re->win->h != e->output.h) ||