Assert if we call backend API without a valid backend
This is a backend programming error, and we should not tolerate failures in these cases.
This commit is contained in:
parent
7e42da123f
commit
7500b77b2b
@ -181,11 +181,10 @@ clutter_backend_real_resolution_changed (ClutterBackend *backend)
|
|||||||
ClutterSettings *settings;
|
ClutterSettings *settings;
|
||||||
gint dpi;
|
gint dpi;
|
||||||
|
|
||||||
context = _clutter_context_get_default ();
|
|
||||||
|
|
||||||
settings = clutter_settings_get_default ();
|
settings = clutter_settings_get_default ();
|
||||||
g_object_get (settings, "font-dpi", &dpi, NULL);
|
g_object_get (settings, "font-dpi", &dpi, NULL);
|
||||||
|
|
||||||
|
context = _clutter_context_get_default ();
|
||||||
if (context->font_map != NULL)
|
if (context->font_map != NULL)
|
||||||
cogl_pango_font_map_set_resolution (context->font_map, dpi / 1024.0);
|
cogl_pango_font_map_set_resolution (context->font_map, dpi / 1024.0);
|
||||||
|
|
||||||
@ -311,7 +310,7 @@ _clutter_backend_add_options (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
if (klass->add_options)
|
if (klass->add_options)
|
||||||
@ -324,7 +323,7 @@ _clutter_backend_pre_parse (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), FALSE);
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
if (klass->pre_parse)
|
if (klass->pre_parse)
|
||||||
@ -339,7 +338,7 @@ _clutter_backend_post_parse (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), FALSE);
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
if (klass->post_parse)
|
if (klass->post_parse)
|
||||||
@ -357,8 +356,8 @@ _clutter_backend_create_stage (ClutterBackend *backend,
|
|||||||
ClutterStageManager *stage_manager;
|
ClutterStageManager *stage_manager;
|
||||||
ClutterStageWindow *stage_window;
|
ClutterStageWindow *stage_window;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
g_return_val_if_fail (CLUTTER_IS_STAGE (wrapper), NULL);
|
g_assert (CLUTTER_IS_STAGE (wrapper));
|
||||||
|
|
||||||
stage_manager = clutter_stage_manager_get_default ();
|
stage_manager = clutter_stage_manager_get_default ();
|
||||||
|
|
||||||
@ -406,8 +405,6 @@ _clutter_backend_create_context (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), FALSE);
|
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
if (klass->create_context)
|
if (klass->create_context)
|
||||||
return klass->create_context (backend, error);
|
return klass->create_context (backend, error);
|
||||||
@ -430,8 +427,8 @@ _clutter_backend_ensure_context (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
static ClutterStage *current_context_stage = NULL;
|
static ClutterStage *current_context_stage = NULL;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
g_assert (CLUTTER_IS_STAGE (stage));
|
||||||
|
|
||||||
if (current_context_stage != stage || !CLUTTER_ACTOR_IS_REALIZED (stage))
|
if (current_context_stage != stage || !CLUTTER_ACTOR_IS_REALIZED (stage))
|
||||||
{
|
{
|
||||||
@ -500,7 +497,7 @@ _clutter_backend_get_features (ClutterBackend *backend)
|
|||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), 0);
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
|
|
||||||
@ -509,7 +506,7 @@ _clutter_backend_get_features (ClutterBackend *backend)
|
|||||||
* context already exists this should be a no-op
|
* context already exists this should be a no-op
|
||||||
*/
|
*/
|
||||||
error = NULL;
|
error = NULL;
|
||||||
if (klass->create_context)
|
if (klass->create_context != NULL)
|
||||||
{
|
{
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
@ -538,12 +535,8 @@ void
|
|||||||
_clutter_backend_init_events (ClutterBackend *backend)
|
_clutter_backend_init_events (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
ClutterMainContext *clutter_context;
|
|
||||||
|
|
||||||
clutter_context = _clutter_context_get_default ();
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
|
||||||
g_return_if_fail (clutter_context != NULL);
|
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
if (klass->init_events)
|
if (klass->init_events)
|
||||||
@ -556,8 +549,6 @@ _clutter_backend_get_units_per_em (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendPrivate *priv;
|
ClutterBackendPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), 0);
|
|
||||||
|
|
||||||
priv = backend->priv;
|
priv = backend->priv;
|
||||||
|
|
||||||
/* recompute for the font description, but do not cache the result */
|
/* recompute for the font description, but do not cache the result */
|
||||||
@ -577,10 +568,6 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
|
||||||
g_return_if_fail (src != NULL);
|
|
||||||
g_return_if_fail (dest != NULL);
|
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
if (klass->copy_event_data != NULL)
|
if (klass->copy_event_data != NULL)
|
||||||
klass->copy_event_data (backend, src, dest);
|
klass->copy_event_data (backend, src, dest);
|
||||||
@ -592,9 +579,6 @@ _clutter_backend_free_event_data (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendClass *klass;
|
ClutterBackendClass *klass;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
|
||||||
g_return_if_fail (event != NULL);
|
|
||||||
|
|
||||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||||
if (klass->free_event_data != NULL)
|
if (klass->free_event_data != NULL)
|
||||||
klass->free_event_data (backend, event);
|
klass->free_event_data (backend, event);
|
||||||
@ -622,8 +606,6 @@ clutter_get_default_backend (void)
|
|||||||
return clutter_context->backend;
|
return clutter_context->backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: below should probably be moved into clutter_main */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_backend_set_double_click_time:
|
* clutter_backend_set_double_click_time:
|
||||||
* @backend: a #ClutterBackend
|
* @backend: a #ClutterBackend
|
||||||
@ -921,8 +903,6 @@ clutter_backend_get_font_name (ClutterBackend *backend)
|
|||||||
gint32
|
gint32
|
||||||
_clutter_backend_get_units_serial (ClutterBackend *backend)
|
_clutter_backend_get_units_serial (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), 0);
|
|
||||||
|
|
||||||
return backend->priv->units_serial;
|
return backend->priv->units_serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -931,8 +911,6 @@ _clutter_backend_translate_event (ClutterBackend *backend,
|
|||||||
gpointer native,
|
gpointer native,
|
||||||
ClutterEvent *event)
|
ClutterEvent *event)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), FALSE);
|
|
||||||
|
|
||||||
return CLUTTER_BACKEND_GET_CLASS (backend)->translate_event (backend,
|
return CLUTTER_BACKEND_GET_CLASS (backend)->translate_event (backend,
|
||||||
native,
|
native,
|
||||||
event);
|
event);
|
||||||
|
Loading…
Reference in New Issue
Block a user