2008-10-31 Emmanuele Bassi <ebassi@linux.intel.com>

Bug 1200 - Crash with invalid DISPLAY

	* clutter/clutter-main.c: Use the ClutterBackend wrapper API
	instead of directly checking the class structure.

	* clutter/glx/clutter-backend-glx.c: Return the correct value
	in case of failure.

	* clutter/x11/clutter-backend-x11.c: Bail out if XOpenDisplay()
	failed.
This commit is contained in:
Emmanuele Bassi 2008-10-31 12:48:26 +00:00
parent 850e6318e3
commit 91f2653b71
4 changed files with 28 additions and 9 deletions

View File

@ -1,3 +1,16 @@
2008-10-31 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1200 - Crash with invalid DISPLAY
* clutter/clutter-main.c: Use the ClutterBackend wrapper API
instead of directly checking the class structure.
* clutter/glx/clutter-backend-glx.c: Return the correct value
in case of failure.
* clutter/x11/clutter-backend-x11.c: Bail out if XOpenDisplay()
failed.
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/cogl/cogl-color.h:

View File

@ -1063,9 +1063,8 @@ clutter_init_real (GError **error)
/*
* Call backend post parse hooks.
*/
if (CLUTTER_BACKEND_GET_CLASS (backend)->post_parse)
if (!CLUTTER_BACKEND_GET_CLASS (backend)->post_parse (backend, error))
return CLUTTER_INIT_ERROR_BACKEND;
if (!_clutter_backend_post_parse (backend, error))
return CLUTTER_INIT_ERROR_BACKEND;
/*
* Resolution requires display to be open, so can only be queried after
@ -1208,10 +1207,7 @@ pre_parse_hook (GOptionContext *context,
clutter_default_fps = CLAMP (default_fps, 1, 1000);
}
if (CLUTTER_BACKEND_GET_CLASS (backend)->pre_parse)
return CLUTTER_BACKEND_GET_CLASS (backend)->pre_parse (backend, error);
return TRUE;
return _clutter_backend_pre_parse (backend, error);
}
/* post_parse_hook: initialise the context and data structures

View File

@ -135,14 +135,16 @@ clutter_backend_glx_post_parse (ClutterBackend *backend,
g_set_error (error, CLUTTER_INIT_ERROR,
CLUTTER_INIT_ERROR_BACKEND,
"XServer appears to lack required GLX support");
return 1;
return FALSE;
}
}
else
return FALSE;
return TRUE;
}
static const GOptionEntry entries[] =
{
{ "vblank", 0,

View File

@ -138,6 +138,14 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
CLUTTER_NOTE (BACKEND, "XOpenDisplay on `%s'",
clutter_display_name);
backend_x11->xdpy = XOpenDisplay (clutter_display_name);
if (backend_x11->xdpy == None)
{
g_set_error (error, CLUTTER_INIT_ERROR,
CLUTTER_INIT_ERROR_BACKEND,
"Unable to open display `%s'",
clutter_display_name);
return FALSE;
}
}
else
{