Revert "Replace most GObject warnings with criticals"

This reverts commit 0ffe86a1f7e215e4561c3b9f1d03c3cd638ed00f.

This was intended to land for the 2.75.x unstable series, and not in the
2.74.x stable series.

Fixes: #2788
This commit is contained in:
Philip Withnall 2022-10-21 12:51:00 +01:00
parent f147c5eed1
commit b89e825cc1
14 changed files with 394 additions and 393 deletions

View File

@ -73,7 +73,7 @@ test_store_non_gobjects (void)
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed (); g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*value * of type 'GType' is invalid or " g_test_trap_assert_stderr ("*WARNING*value * of type 'GType' is invalid or "
"out of range for property 'item-type'*"); "out of range for property 'item-type'*");
} }

View File

@ -464,7 +464,7 @@ default_transform (GBinding *binding,
return TRUE; return TRUE;
} }
g_critical ("%s: Unable to convert a value of type %s to a " g_warning ("%s: Unable to convert a value of type %s to a "
"value of type %s", "value of type %s",
G_STRLOC, G_STRLOC,
g_type_name (G_VALUE_TYPE (value_a)), g_type_name (G_VALUE_TYPE (value_a)),
@ -1253,7 +1253,7 @@ g_object_bind_property_full (gpointer source,
if (source == target && g_strcmp0 (source_property, target_property) == 0) if (source == target && g_strcmp0 (source_property, target_property) == 0)
{ {
g_critical ("Unable to bind the same property on the same instance"); g_warning ("Unable to bind the same property on the same instance");
return NULL; return NULL;
} }
@ -1269,7 +1269,7 @@ g_object_bind_property_full (gpointer source,
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (source), source_property); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (source), source_property);
if (pspec == NULL) if (pspec == NULL)
{ {
g_critical ("%s: The source object of type %s has no property called '%s'", g_warning ("%s: The source object of type %s has no property called '%s'",
G_STRLOC, G_STRLOC,
G_OBJECT_TYPE_NAME (source), G_OBJECT_TYPE_NAME (source),
source_property); source_property);
@ -1278,7 +1278,7 @@ g_object_bind_property_full (gpointer source,
if (!(pspec->flags & G_PARAM_READABLE)) if (!(pspec->flags & G_PARAM_READABLE))
{ {
g_critical ("%s: The source object of type %s has no readable property called '%s'", g_warning ("%s: The source object of type %s has no readable property called '%s'",
G_STRLOC, G_STRLOC,
G_OBJECT_TYPE_NAME (source), G_OBJECT_TYPE_NAME (source),
source_property); source_property);
@ -1288,7 +1288,7 @@ g_object_bind_property_full (gpointer source,
if ((flags & G_BINDING_BIDIRECTIONAL) && if ((flags & G_BINDING_BIDIRECTIONAL) &&
((pspec->flags & G_PARAM_CONSTRUCT_ONLY) || !(pspec->flags & G_PARAM_WRITABLE))) ((pspec->flags & G_PARAM_CONSTRUCT_ONLY) || !(pspec->flags & G_PARAM_WRITABLE)))
{ {
g_critical ("%s: The source object of type %s has no writable property called '%s'", g_warning ("%s: The source object of type %s has no writable property called '%s'",
G_STRLOC, G_STRLOC,
G_OBJECT_TYPE_NAME (source), G_OBJECT_TYPE_NAME (source),
source_property); source_property);
@ -1298,7 +1298,7 @@ g_object_bind_property_full (gpointer source,
if ((flags & G_BINDING_INVERT_BOOLEAN) && if ((flags & G_BINDING_INVERT_BOOLEAN) &&
!(G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN)) !(G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN))
{ {
g_critical ("%s: The G_BINDING_INVERT_BOOLEAN flag can only be used " g_warning ("%s: The G_BINDING_INVERT_BOOLEAN flag can only be used "
"when binding boolean properties; the source property '%s' " "when binding boolean properties; the source property '%s' "
"is of type '%s'", "is of type '%s'",
G_STRLOC, G_STRLOC,
@ -1310,7 +1310,7 @@ g_object_bind_property_full (gpointer source,
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (target), target_property); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (target), target_property);
if (pspec == NULL) if (pspec == NULL)
{ {
g_critical ("%s: The target object of type %s has no property called '%s'", g_warning ("%s: The target object of type %s has no property called '%s'",
G_STRLOC, G_STRLOC,
G_OBJECT_TYPE_NAME (target), G_OBJECT_TYPE_NAME (target),
target_property); target_property);
@ -1319,7 +1319,7 @@ g_object_bind_property_full (gpointer source,
if ((pspec->flags & G_PARAM_CONSTRUCT_ONLY) || !(pspec->flags & G_PARAM_WRITABLE)) if ((pspec->flags & G_PARAM_CONSTRUCT_ONLY) || !(pspec->flags & G_PARAM_WRITABLE))
{ {
g_critical ("%s: The target object of type %s has no writable property called '%s'", g_warning ("%s: The target object of type %s has no writable property called '%s'",
G_STRLOC, G_STRLOC,
G_OBJECT_TYPE_NAME (target), G_OBJECT_TYPE_NAME (target),
target_property); target_property);
@ -1329,7 +1329,7 @@ g_object_bind_property_full (gpointer source,
if ((flags & G_BINDING_BIDIRECTIONAL) && if ((flags & G_BINDING_BIDIRECTIONAL) &&
!(pspec->flags & G_PARAM_READABLE)) !(pspec->flags & G_PARAM_READABLE))
{ {
g_critical ("%s: The target object of type %s has no readable property called '%s'", g_warning ("%s: The target object of type %s has no readable property called '%s'",
G_STRLOC, G_STRLOC,
G_OBJECT_TYPE_NAME (target), G_OBJECT_TYPE_NAME (target),
target_property); target_property);
@ -1339,7 +1339,7 @@ g_object_bind_property_full (gpointer source,
if ((flags & G_BINDING_INVERT_BOOLEAN) && if ((flags & G_BINDING_INVERT_BOOLEAN) &&
!(G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN)) !(G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN))
{ {
g_critical ("%s: The G_BINDING_INVERT_BOOLEAN flag can only be used " g_warning ("%s: The G_BINDING_INVERT_BOOLEAN flag can only be used "
"when binding boolean properties; the target property '%s' " "when binding boolean properties; the target property '%s' "
"is of type '%s'", "is of type '%s'",
G_STRLOC, G_STRLOC,

View File

@ -748,7 +748,7 @@ g_closure_remove_invalidate_notifier (GClosure *closure,
closure->data == notify_data) closure->data == notify_data)
closure->marshal = NULL; closure->marshal = NULL;
else if (!closure_try_remove_inotify (closure, notify_data, notify_func)) else if (!closure_try_remove_inotify (closure, notify_data, notify_func))
g_critical (G_STRLOC ": unable to remove uninstalled invalidation notifier: %p (%p)", g_warning (G_STRLOC ": unable to remove uninstalled invalidation notifier: %p (%p)",
notify_func, notify_data); notify_func, notify_data);
} }
@ -776,7 +776,7 @@ g_closure_remove_finalize_notifier (GClosure *closure,
closure->data == notify_data) closure->data == notify_data)
closure->marshal = NULL; closure->marshal = NULL;
else if (!closure_try_remove_fnotify (closure, notify_data, notify_func)) else if (!closure_try_remove_fnotify (closure, notify_data, notify_func))
g_critical (G_STRLOC ": unable to remove uninstalled finalization notifier: %p (%p)", g_warning (G_STRLOC ": unable to remove uninstalled finalization notifier: %p (%p)",
notify_func, notify_data); notify_func, notify_data);
} }
@ -929,7 +929,7 @@ g_closure_set_marshal (GClosure *closure,
g_return_if_fail (marshal != NULL); g_return_if_fail (marshal != NULL);
if (closure->marshal && closure->marshal != marshal) if (closure->marshal && closure->marshal != marshal)
g_critical ("attempt to override closure->marshal (%p) with new marshal (%p)", g_warning ("attempt to override closure->marshal (%p) with new marshal (%p)",
closure->marshal, marshal); closure->marshal, marshal);
else else
closure->marshal = marshal; closure->marshal = marshal;
@ -947,7 +947,7 @@ _g_closure_set_va_marshal (GClosure *closure,
real_closure = G_REAL_CLOSURE (closure); real_closure = G_REAL_CLOSURE (closure);
if (real_closure->va_marshal && real_closure->va_marshal != marshal) if (real_closure->va_marshal && real_closure->va_marshal != marshal)
g_critical ("attempt to override closure->va_marshal (%p) with new marshal (%p)", g_warning ("attempt to override closure->va_marshal (%p) with new marshal (%p)",
real_closure->va_marshal, marshal); real_closure->va_marshal, marshal);
else else
real_closure->va_marshal = marshal; real_closure->va_marshal = marshal;
@ -1274,7 +1274,7 @@ value_to_ffi_type (const GValue *gvalue,
default: default:
rettype = &ffi_type_pointer; rettype = &ffi_type_pointer;
*value = NULL; *value = NULL;
g_critical ("value_to_ffi_type: Unsupported fundamental type: %s", g_type_name (type)); g_warning ("value_to_ffi_type: Unsupported fundamental type: %s", g_type_name (type));
break; break;
} }
return rettype; return rettype;
@ -1354,7 +1354,7 @@ restart:
goto restart; goto restart;
G_GNUC_FALLTHROUGH; G_GNUC_FALLTHROUGH;
default: default:
g_critical ("value_from_ffi_type: Unsupported fundamental type %s for type %s", g_warning ("value_from_ffi_type: Unsupported fundamental type %s for type %s",
g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))), g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))),
g_type_name (G_VALUE_TYPE (gvalue))); g_type_name (G_VALUE_TYPE (gvalue)));
} }
@ -1434,7 +1434,7 @@ va_to_ffi_type (GType gtype,
default: default:
rettype = &ffi_type_pointer; rettype = &ffi_type_pointer;
storage->_guint64 = 0; storage->_guint64 = 0;
g_critical ("va_to_ffi_type: Unsupported fundamental type: %s", g_type_name (type)); g_warning ("va_to_ffi_type: Unsupported fundamental type: %s", g_type_name (type));
break; break;
} }
return rettype; return rettype;

View File

@ -333,7 +333,7 @@ g_object_notify_queue_thaw (GObject *object,
if (G_UNLIKELY (nqueue->freeze_count == 0)) if (G_UNLIKELY (nqueue->freeze_count == 0))
{ {
G_UNLOCK (notify_lock); G_UNLOCK (notify_lock);
g_critical ("%s: property-changed notification for %s(%p) is not frozen", g_warning ("%s: property-changed notification for %s(%p) is not frozen",
G_STRFUNC, G_OBJECT_TYPE_NAME (object), object); G_STRFUNC, G_OBJECT_TYPE_NAME (object), object);
return; return;
} }
@ -598,7 +598,7 @@ install_property_internal (GType g_type,
if (g_param_spec_pool_lookup (pspec_pool, pspec->name, g_type, FALSE)) if (g_param_spec_pool_lookup (pspec_pool, pspec->name, g_type, FALSE))
{ {
g_critical ("When installing property: type '%s' already has a property named '%s'", g_warning ("When installing property: type '%s' already has a property named '%s'",
g_type_name (g_type), g_type_name (g_type),
pspec->name); pspec->name);
g_param_spec_unref (pspec); g_param_spec_unref (pspec);
@ -1096,7 +1096,7 @@ g_object_class_override_property (GObjectClass *oclass,
if (!overridden) if (!overridden)
{ {
g_critical ("%s: Can't find property to override for '%s::%s'", g_warning ("%s: Can't find property to override for '%s::%s'",
G_STRFUNC, G_OBJECT_CLASS_NAME (oclass), name); G_STRFUNC, G_OBJECT_CLASS_NAME (oclass), name);
return; return;
} }
@ -1586,7 +1586,7 @@ g_object_notify (GObject *object,
TRUE); TRUE);
if (!pspec) if (!pspec)
g_critical ("%s: object class '%s' has no property named '%s'", g_warning ("%s: object class '%s' has no property named '%s'",
G_STRFUNC, G_STRFUNC,
G_OBJECT_TYPE_NAME (object), G_OBJECT_TYPE_NAME (object),
property_name); property_name);
@ -1801,7 +1801,7 @@ object_set_property (GObject *object,
g_value_init (&tmp_value, pspec->value_type); g_value_init (&tmp_value, pspec->value_type);
if (!g_value_transform (value, &tmp_value)) if (!g_value_transform (value, &tmp_value))
g_critical ("unable to set property '%s' of type '%s' from value of type '%s'", g_warning ("unable to set property '%s' of type '%s' from value of type '%s'",
pspec->name, pspec->name,
g_type_name (pspec->value_type), g_type_name (pspec->value_type),
G_VALUE_TYPE_NAME (value)); G_VALUE_TYPE_NAME (value));
@ -1809,7 +1809,7 @@ object_set_property (GObject *object,
{ {
gchar *contents = g_strdup_value_contents (value); gchar *contents = g_strdup_value_contents (value);
g_critical ("value \"%s\" of type '%s' is invalid or out of range for property '%s' of type '%s'", g_warning ("value \"%s\" of type '%s' is invalid or out of range for property '%s' of type '%s'",
contents, contents,
G_VALUE_TYPE_NAME (value), G_VALUE_TYPE_NAME (value),
pspec->name, pspec->name,
@ -2639,19 +2639,19 @@ g_object_set_is_valid_property (GObject *object,
{ {
if (G_UNLIKELY (pspec == NULL)) if (G_UNLIKELY (pspec == NULL))
{ {
g_critical ("%s: object class '%s' has no property named '%s'", g_warning ("%s: object class '%s' has no property named '%s'",
G_STRFUNC, G_OBJECT_TYPE_NAME (object), property_name); G_STRFUNC, G_OBJECT_TYPE_NAME (object), property_name);
return FALSE; return FALSE;
} }
if (G_UNLIKELY (!(pspec->flags & G_PARAM_WRITABLE))) if (G_UNLIKELY (!(pspec->flags & G_PARAM_WRITABLE)))
{ {
g_critical ("%s: property '%s' of object class '%s' is not writable", g_warning ("%s: property '%s' of object class '%s' is not writable",
G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (object)); G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (object));
return FALSE; return FALSE;
} }
if (G_UNLIKELY (((pspec->flags & G_PARAM_CONSTRUCT_ONLY) && !object_in_construction (object)))) if (G_UNLIKELY (((pspec->flags & G_PARAM_CONSTRUCT_ONLY) && !object_in_construction (object))))
{ {
g_critical ("%s: construct property \"%s\" for object '%s' can't be set after construction", g_warning ("%s: construct property \"%s\" for object '%s' can't be set after construction",
G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (object)); G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (object));
return FALSE; return FALSE;
} }
@ -2754,7 +2754,7 @@ g_object_set_valist (GObject *object,
G_VALUE_COLLECT_INIT2 (&value, vtab, pspec->value_type, var_args, G_VALUE_NOCOPY_CONTENTS, &error); G_VALUE_COLLECT_INIT2 (&value, vtab, pspec->value_type, var_args, G_VALUE_NOCOPY_CONTENTS, &error);
if (error) if (error)
{ {
g_critical ("%s: %s", G_STRFUNC, error); g_warning ("%s: %s", G_STRFUNC, error);
g_free (error); g_free (error);
g_value_unset (&value); g_value_unset (&value);
break; break;
@ -2784,13 +2784,13 @@ g_object_get_is_valid_property (GObject *object,
{ {
if (G_UNLIKELY (pspec == NULL)) if (G_UNLIKELY (pspec == NULL))
{ {
g_critical ("%s: object class '%s' has no property named '%s'", g_warning ("%s: object class '%s' has no property named '%s'",
G_STRFUNC, G_OBJECT_TYPE_NAME (object), property_name); G_STRFUNC, G_OBJECT_TYPE_NAME (object), property_name);
return FALSE; return FALSE;
} }
if (G_UNLIKELY (!(pspec->flags & G_PARAM_READABLE))) if (G_UNLIKELY (!(pspec->flags & G_PARAM_READABLE)))
{ {
g_critical ("%s: property '%s' of object class '%s' is not readable", g_warning ("%s: property '%s' of object class '%s' is not readable",
G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (object)); G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (object));
return FALSE; return FALSE;
} }
@ -2893,7 +2893,7 @@ g_object_get_valist (GObject *object,
G_VALUE_LCOPY (&value, var_args, 0, &error); G_VALUE_LCOPY (&value, var_args, 0, &error);
if (error) if (error)
{ {
g_critical ("%s: %s", G_STRFUNC, error); g_warning ("%s: %s", G_STRFUNC, error);
g_free (error); g_free (error);
g_value_unset (&value); g_value_unset (&value);
break; break;
@ -3061,7 +3061,7 @@ g_object_get_property (GObject *object,
} }
else if (!g_value_type_transformable (pspec->value_type, G_VALUE_TYPE (value))) else if (!g_value_type_transformable (pspec->value_type, G_VALUE_TYPE (value)))
{ {
g_critical ("%s: can't retrieve property '%s' of type '%s' as value of type '%s'", g_warning ("%s: can't retrieve property '%s' of type '%s' as value of type '%s'",
G_STRFUNC, pspec->name, G_STRFUNC, pspec->name,
g_type_name (pspec->value_type), g_type_name (pspec->value_type),
G_VALUE_TYPE_NAME (value)); G_VALUE_TYPE_NAME (value));
@ -3176,7 +3176,7 @@ g_object_connect (gpointer _object,
G_CONNECT_SWAPPED | G_CONNECT_AFTER); G_CONNECT_SWAPPED | G_CONNECT_AFTER);
else else
{ {
g_critical ("%s: invalid signal spec \"%s\"", G_STRFUNC, signal_spec); g_warning ("%s: invalid signal spec \"%s\"", G_STRFUNC, signal_spec);
break; break;
} }
signal_spec = va_arg (var_args, gchar*); signal_spec = va_arg (var_args, gchar*);
@ -3233,17 +3233,17 @@ g_object_disconnect (gpointer _object,
} }
else else
{ {
g_critical ("%s: invalid signal spec \"%s\"", G_STRFUNC, signal_spec); g_warning ("%s: invalid signal spec \"%s\"", G_STRFUNC, signal_spec);
break; break;
} }
if ((mask & G_SIGNAL_MATCH_ID) && if ((mask & G_SIGNAL_MATCH_ID) &&
!g_signal_parse_name (signal_spec, G_OBJECT_TYPE (object), &sid, &detail, FALSE)) !g_signal_parse_name (signal_spec, G_OBJECT_TYPE (object), &sid, &detail, FALSE))
g_critical ("%s: invalid signal name \"%s\"", G_STRFUNC, signal_spec); g_warning ("%s: invalid signal name \"%s\"", G_STRFUNC, signal_spec);
else if (!g_signal_handlers_disconnect_matched (object, mask | (detail ? G_SIGNAL_MATCH_DETAIL : 0), else if (!g_signal_handlers_disconnect_matched (object, mask | (detail ? G_SIGNAL_MATCH_DETAIL : 0),
sid, detail, sid, detail,
NULL, (gpointer)callback, data)) NULL, (gpointer)callback, data))
g_critical ("%s: signal handler %p(%p) is not connected", G_STRFUNC, callback, data); g_warning ("%s: signal handler %p(%p) is not connected", G_STRFUNC, callback, data);
signal_spec = va_arg (var_args, gchar*); signal_spec = va_arg (var_args, gchar*);
} }
va_end (var_args); va_end (var_args);
@ -3357,7 +3357,7 @@ g_object_weak_unref (GObject *object,
} }
G_UNLOCK (weak_refs_mutex); G_UNLOCK (weak_refs_mutex);
if (!found_one) if (!found_one)
g_critical ("%s: couldn't find weak ref %p(%p)", G_STRFUNC, notify, data); g_warning ("%s: couldn't find weak ref %p(%p)", G_STRFUNC, notify, data);
} }
/** /**
@ -3731,7 +3731,7 @@ g_object_remove_toggle_ref (GObject *object,
if (found_one) if (found_one)
g_object_unref (object); g_object_unref (object);
else else
g_critical ("%s: couldn't find toggle ref %p(%p)", G_STRFUNC, notify, data); g_warning ("%s: couldn't find toggle ref %p(%p)", G_STRFUNC, notify, data);
} }
/** /**

View File

@ -113,7 +113,7 @@ g_object_notify_queue_thaw (GObject *object,
/* Just make sure we never get into some nasty race condition */ /* Just make sure we never get into some nasty race condition */
if (G_UNLIKELY(nqueue->freeze_count == 0)) { if (G_UNLIKELY(nqueue->freeze_count == 0)) {
G_UNLOCK(notify_lock); G_UNLOCK(notify_lock);
g_critical ("%s: property-changed notification for %s(%p) is not frozen", g_warning ("%s: property-changed notification for %s(%p) is not frozen",
G_STRFUNC, G_OBJECT_TYPE_NAME (object), object); G_STRFUNC, G_OBJECT_TYPE_NAME (object), object);
return; return;
} }

View File

@ -1022,7 +1022,7 @@ g_param_spec_pool_insert (GParamSpecPool *pool,
{ {
if (!strchr (G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-_", *p)) if (!strchr (G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-_", *p))
{ {
g_critical (G_STRLOC ": pspec name \"%s\" contains invalid characters", pspec->name); g_warning (G_STRLOC ": pspec name \"%s\" contains invalid characters", pspec->name);
return; return;
} }
} }
@ -1058,7 +1058,7 @@ g_param_spec_pool_remove (GParamSpecPool *pool,
if (g_hash_table_remove (pool->hash_table, pspec)) if (g_hash_table_remove (pool->hash_table, pspec))
g_param_spec_unref (pspec); g_param_spec_unref (pspec);
else else
g_critical (G_STRLOC ": attempt to remove unknown pspec '%s' from pool", pspec->name); g_warning (G_STRLOC ": attempt to remove unknown pspec '%s' from pool", pspec->name);
g_mutex_unlock (&pool->mutex); g_mutex_unlock (&pool->mutex);
} }
else else

View File

@ -955,7 +955,7 @@ _g_signals_destroy (GType itype)
if (node->itype == itype) if (node->itype == itype)
{ {
if (node->destroyed) if (node->destroyed)
g_critical (G_STRLOC ": signal \"%s\" of type '%s' already destroyed", g_warning (G_STRLOC ": signal \"%s\" of type '%s' already destroyed",
node->name, node->name,
type_debug_name (node->itype)); type_debug_name (node->itype));
else else
@ -993,7 +993,7 @@ g_signal_stop_emission (gpointer instance,
node = LOOKUP_SIGNAL_NODE (signal_id); node = LOOKUP_SIGNAL_NODE (signal_id);
if (node && detail && !(node->flags & G_SIGNAL_DETAILED)) if (node && detail && !(node->flags & G_SIGNAL_DETAILED))
{ {
g_critical ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail); g_warning ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return; return;
} }
@ -1004,17 +1004,17 @@ g_signal_stop_emission (gpointer instance,
if (emission) if (emission)
{ {
if (emission->state == EMISSION_HOOK) if (emission->state == EMISSION_HOOK)
g_critical (G_STRLOC ": emission of signal \"%s\" for instance '%p' cannot be stopped from emission hook", g_warning (G_STRLOC ": emission of signal \"%s\" for instance '%p' cannot be stopped from emission hook",
node->name, instance); node->name, instance);
else if (emission->state == EMISSION_RUN) else if (emission->state == EMISSION_RUN)
emission->state = EMISSION_STOP; emission->state = EMISSION_STOP;
} }
else else
g_critical (G_STRLOC ": no emission of signal \"%s\" to stop for instance '%p'", g_warning (G_STRLOC ": no emission of signal \"%s\" to stop for instance '%p'",
node->name, instance); node->name, instance);
} }
else else
g_critical ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance); g_warning ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
} }
@ -1066,19 +1066,19 @@ g_signal_add_emission_hook (guint signal_id,
node = LOOKUP_SIGNAL_NODE (signal_id); node = LOOKUP_SIGNAL_NODE (signal_id);
if (!node || node->destroyed) if (!node || node->destroyed)
{ {
g_critical ("%s: invalid signal id '%u'", G_STRLOC, signal_id); g_warning ("%s: invalid signal id '%u'", G_STRLOC, signal_id);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return 0; return 0;
} }
if (node->flags & G_SIGNAL_NO_HOOKS) if (node->flags & G_SIGNAL_NO_HOOKS)
{ {
g_critical ("%s: signal id '%u' does not support emission hooks (G_SIGNAL_NO_HOOKS flag set)", G_STRLOC, signal_id); g_warning ("%s: signal id '%u' does not support emission hooks (G_SIGNAL_NO_HOOKS flag set)", G_STRLOC, signal_id);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return 0; return 0;
} }
if (detail && !(node->flags & G_SIGNAL_DETAILED)) if (detail && !(node->flags & G_SIGNAL_DETAILED))
{ {
g_critical ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail); g_warning ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return 0; return 0;
} }
@ -1128,11 +1128,11 @@ g_signal_remove_emission_hook (guint signal_id,
node = LOOKUP_SIGNAL_NODE (signal_id); node = LOOKUP_SIGNAL_NODE (signal_id);
if (!node || node->destroyed) if (!node || node->destroyed)
{ {
g_critical ("%s: invalid signal id '%u'", G_STRLOC, signal_id); g_warning ("%s: invalid signal id '%u'", G_STRLOC, signal_id);
goto out; goto out;
} }
else if (!node->emission_hooks || !g_hook_destroy (node->emission_hooks, hook_id)) else if (!node->emission_hooks || !g_hook_destroy (node->emission_hooks, hook_id))
g_critical ("%s: signal \"%s\" had no hook (%lu) to remove", G_STRLOC, node->name, hook_id); g_warning ("%s: signal \"%s\" had no hook (%lu) to remove", G_STRLOC, node->name, hook_id);
node->single_va_closure_is_valid = FALSE; node->single_va_closure_is_valid = FALSE;
@ -1265,9 +1265,9 @@ g_signal_stop_emission_by_name (gpointer instance,
SignalNode *node = LOOKUP_SIGNAL_NODE (signal_id); SignalNode *node = LOOKUP_SIGNAL_NODE (signal_id);
if (detail && !(node->flags & G_SIGNAL_DETAILED)) if (detail && !(node->flags & G_SIGNAL_DETAILED))
g_critical ("%s: signal '%s' does not support details", G_STRLOC, detailed_signal); g_warning ("%s: signal '%s' does not support details", G_STRLOC, detailed_signal);
else if (!g_type_is_a (itype, node->itype)) else if (!g_type_is_a (itype, node->itype))
g_critical ("%s: signal '%s' is invalid for instance '%p' of type '%s'", g_warning ("%s: signal '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype)); G_STRLOC, detailed_signal, instance, g_type_name (itype));
else else
{ {
@ -1276,18 +1276,18 @@ g_signal_stop_emission_by_name (gpointer instance,
if (emission) if (emission)
{ {
if (emission->state == EMISSION_HOOK) if (emission->state == EMISSION_HOOK)
g_critical (G_STRLOC ": emission of signal \"%s\" for instance '%p' cannot be stopped from emission hook", g_warning (G_STRLOC ": emission of signal \"%s\" for instance '%p' cannot be stopped from emission hook",
node->name, instance); node->name, instance);
else if (emission->state == EMISSION_RUN) else if (emission->state == EMISSION_RUN)
emission->state = EMISSION_STOP; emission->state = EMISSION_STOP;
} }
else else
g_critical (G_STRLOC ": no emission of signal \"%s\" to stop for instance '%p'", g_warning (G_STRLOC ": no emission of signal \"%s\" to stop for instance '%p'",
node->name, instance); node->name, instance);
} }
} }
else else
g_critical ("%s: signal '%s' is invalid for instance '%p' of type '%s'", g_warning ("%s: signal '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype)); G_STRLOC, detailed_signal, instance, g_type_name (itype));
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
} }
@ -1326,10 +1326,10 @@ g_signal_lookup (const gchar *name,
{ {
/* give elaborate warnings */ /* give elaborate warnings */
if (!g_type_name (itype)) if (!g_type_name (itype))
g_critical (G_STRLOC ": unable to look up signal \"%s\" for invalid type id '%"G_GSIZE_FORMAT"'", g_warning (G_STRLOC ": unable to look up signal \"%s\" for invalid type id '%"G_GSIZE_FORMAT"'",
name, itype); name, itype);
else if (!g_signal_is_valid_name (name)) else if (!g_signal_is_valid_name (name))
g_critical (G_STRLOC ": unable to look up invalid signal name \"%s\" on type '%s'", g_warning (G_STRLOC ": unable to look up invalid signal name \"%s\" on type '%s'",
name, g_type_name (itype)); name, g_type_name (itype));
} }
@ -1375,13 +1375,13 @@ g_signal_list_ids (GType itype,
{ {
/* give elaborate warnings */ /* give elaborate warnings */
if (!g_type_name (itype)) if (!g_type_name (itype))
g_critical (G_STRLOC ": unable to list signals for invalid type id '%"G_GSIZE_FORMAT"'", g_warning (G_STRLOC ": unable to list signals for invalid type id '%"G_GSIZE_FORMAT"'",
itype); itype);
else if (!G_TYPE_IS_INSTANTIATABLE (itype) && !G_TYPE_IS_INTERFACE (itype)) else if (!G_TYPE_IS_INSTANTIATABLE (itype) && !G_TYPE_IS_INTERFACE (itype))
g_critical (G_STRLOC ": unable to list signals of non instantiatable type '%s'", g_warning (G_STRLOC ": unable to list signals of non instantiatable type '%s'",
g_type_name (itype)); g_type_name (itype));
else if (!g_type_class_peek (itype) && !G_TYPE_IS_INTERFACE (itype)) else if (!g_type_class_peek (itype) && !G_TYPE_IS_INTERFACE (itype))
g_critical (G_STRLOC ": unable to list signals of unloaded type '%s'", g_warning (G_STRLOC ": unable to list signals of unloaded type '%s'",
g_type_name (itype)); g_type_name (itype));
} }
@ -1743,7 +1743,7 @@ g_signal_newv (const gchar *signal_name,
node = LOOKUP_SIGNAL_NODE (signal_id); node = LOOKUP_SIGNAL_NODE (signal_id);
if (node && !node->destroyed) if (node && !node->destroyed)
{ {
g_critical (G_STRLOC ": signal \"%s\" already exists in the '%s' %s", g_warning (G_STRLOC ": signal \"%s\" already exists in the '%s' %s",
name, name,
type_debug_name (node->itype), type_debug_name (node->itype),
G_TYPE_IS_INTERFACE (node->itype) ? "interface" : "class ancestry"); G_TYPE_IS_INTERFACE (node->itype) ? "interface" : "class ancestry");
@ -1753,7 +1753,7 @@ g_signal_newv (const gchar *signal_name,
} }
if (node && node->itype != itype) if (node && node->itype != itype)
{ {
g_critical (G_STRLOC ": signal \"%s\" for type '%s' was previously created for type '%s'", g_warning (G_STRLOC ": signal \"%s\" for type '%s' was previously created for type '%s'",
name, name,
type_debug_name (itype), type_debug_name (itype),
type_debug_name (node->itype)); type_debug_name (node->itype));
@ -1764,7 +1764,7 @@ g_signal_newv (const gchar *signal_name,
for (i = 0; i < n_params; i++) for (i = 0; i < n_params; i++)
if (!G_TYPE_IS_VALUE (param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE)) if (!G_TYPE_IS_VALUE (param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE))
{ {
g_critical (G_STRLOC ": parameter %d of type '%s' for signal \"%s::%s\" is not a value type", g_warning (G_STRLOC ": parameter %d of type '%s' for signal \"%s::%s\" is not a value type",
i + 1, type_debug_name (param_types[i]), type_debug_name (itype), name); i + 1, type_debug_name (param_types[i]), type_debug_name (itype), name);
g_free (signal_name_copy); g_free (signal_name_copy);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
@ -1772,7 +1772,7 @@ g_signal_newv (const gchar *signal_name,
} }
if (return_type != G_TYPE_NONE && !G_TYPE_IS_VALUE (return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE)) if (return_type != G_TYPE_NONE && !G_TYPE_IS_VALUE (return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE))
{ {
g_critical (G_STRLOC ": return value of type '%s' for signal \"%s::%s\" is not a value type", g_warning (G_STRLOC ": return value of type '%s' for signal \"%s::%s\" is not a value type",
type_debug_name (return_type), type_debug_name (itype), name); type_debug_name (return_type), type_debug_name (itype), name);
g_free (signal_name_copy); g_free (signal_name_copy);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
@ -2079,13 +2079,13 @@ g_signal_override_class_closure (guint signal_id,
node = LOOKUP_SIGNAL_NODE (signal_id); node = LOOKUP_SIGNAL_NODE (signal_id);
node_check_deprecated (node); node_check_deprecated (node);
if (!g_type_is_a (instance_type, node->itype)) if (!g_type_is_a (instance_type, node->itype))
g_critical ("%s: type '%s' cannot be overridden for signal id '%u'", G_STRLOC, type_debug_name (instance_type), signal_id); g_warning ("%s: type '%s' cannot be overridden for signal id '%u'", G_STRLOC, type_debug_name (instance_type), signal_id);
else else
{ {
ClassClosure *cc = signal_find_class_closure (node, instance_type); ClassClosure *cc = signal_find_class_closure (node, instance_type);
if (cc && cc->instance_type == instance_type) if (cc && cc->instance_type == instance_type)
g_critical ("%s: type '%s' is already overridden for signal id '%u'", G_STRLOC, type_debug_name (instance_type), signal_id); g_warning ("%s: type '%s' is already overridden for signal id '%u'", G_STRLOC, type_debug_name (instance_type), signal_id);
else else
signal_add_class_closure (node, instance_type, class_closure); signal_add_class_closure (node, instance_type, class_closure);
} }
@ -2127,7 +2127,7 @@ g_signal_override_class_handler (const gchar *signal_name,
g_signal_override_class_closure (signal_id, instance_type, g_signal_override_class_closure (signal_id, instance_type,
g_cclosure_new (class_handler, NULL, NULL)); g_cclosure_new (class_handler, NULL, NULL));
else else
g_critical ("%s: signal name '%s' is invalid for type id '%"G_GSIZE_FORMAT"'", g_warning ("%s: signal name '%s' is invalid for type id '%"G_GSIZE_FORMAT"'",
G_STRLOC, signal_name, instance_type); G_STRLOC, signal_name, instance_type);
} }
@ -2184,10 +2184,10 @@ g_signal_chain_from_overridden (const GValue *instance_and_params,
} }
} }
else else
g_critical ("%s: signal id '%u' cannot be chained from current emission stage for instance '%p'", G_STRLOC, node->signal_id, instance); g_warning ("%s: signal id '%u' cannot be chained from current emission stage for instance '%p'", G_STRLOC, node->signal_id, instance);
} }
else else
g_critical ("%s: no signal is currently being emitted for instance '%p'", G_STRLOC, instance); g_warning ("%s: no signal is currently being emitted for instance '%p'", G_STRLOC, instance);
if (closure) if (closure)
{ {
@ -2257,10 +2257,10 @@ g_signal_chain_from_overridden_handler (gpointer instance,
} }
} }
else else
g_critical ("%s: signal id '%u' cannot be chained from current emission stage for instance '%p'", G_STRLOC, node->signal_id, instance); g_warning ("%s: signal id '%u' cannot be chained from current emission stage for instance '%p'", G_STRLOC, node->signal_id, instance);
} }
else else
g_critical ("%s: no signal is currently being emitted for instance '%p'", G_STRLOC, instance); g_warning ("%s: no signal is currently being emitted for instance '%p'", G_STRLOC, instance);
if (closure) if (closure)
{ {
@ -2289,7 +2289,7 @@ g_signal_chain_from_overridden_handler (gpointer instance,
&error); &error);
if (error) if (error)
{ {
g_critical ("%s: %s", G_STRLOC, error); g_warning ("%s: %s", G_STRLOC, error);
g_free (error); g_free (error);
/* we purposely leak the value here, it might not be /* we purposely leak the value here, it might not be
@ -2345,7 +2345,7 @@ g_signal_chain_from_overridden_handler (gpointer instance,
} }
else else
{ {
g_critical ("%s: %s", G_STRLOC, error); g_warning ("%s: %s", G_STRLOC, error);
g_free (error); g_free (error);
/* we purposely leak the value here, it might not be /* we purposely leak the value here, it might not be
@ -2421,9 +2421,9 @@ g_signal_connect_closure_by_id (gpointer instance,
if (node) if (node)
{ {
if (detail && !(node->flags & G_SIGNAL_DETAILED)) if (detail && !(node->flags & G_SIGNAL_DETAILED))
g_critical ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail); g_warning ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail);
else if (!g_type_is_a (G_TYPE_FROM_INSTANCE (instance), node->itype)) else if (!g_type_is_a (G_TYPE_FROM_INSTANCE (instance), node->itype))
g_critical ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance); g_warning ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance);
else else
{ {
Handler *handler = handler_new (signal_id, instance, after); Handler *handler = handler_new (signal_id, instance, after);
@ -2446,7 +2446,7 @@ g_signal_connect_closure_by_id (gpointer instance,
} }
} }
else else
g_critical ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance); g_warning ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return handler_seq_no; return handler_seq_no;
@ -2487,9 +2487,9 @@ g_signal_connect_closure (gpointer instance,
SignalNode *node = LOOKUP_SIGNAL_NODE (signal_id); SignalNode *node = LOOKUP_SIGNAL_NODE (signal_id);
if (detail && !(node->flags & G_SIGNAL_DETAILED)) if (detail && !(node->flags & G_SIGNAL_DETAILED))
g_critical ("%s: signal '%s' does not support details", G_STRLOC, detailed_signal); g_warning ("%s: signal '%s' does not support details", G_STRLOC, detailed_signal);
else if (!g_type_is_a (itype, node->itype)) else if (!g_type_is_a (itype, node->itype))
g_critical ("%s: signal '%s' is invalid for instance '%p' of type '%s'", g_warning ("%s: signal '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype)); G_STRLOC, detailed_signal, instance, g_type_name (itype));
else else
{ {
@ -2513,7 +2513,7 @@ g_signal_connect_closure (gpointer instance,
} }
} }
else else
g_critical ("%s: signal '%s' is invalid for instance '%p' of type '%s'", g_warning ("%s: signal '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype)); G_STRLOC, detailed_signal, instance, g_type_name (itype));
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
@ -2591,9 +2591,9 @@ g_signal_connect_data (gpointer instance,
node_check_deprecated (node); node_check_deprecated (node);
if (detail && !(node->flags & G_SIGNAL_DETAILED)) if (detail && !(node->flags & G_SIGNAL_DETAILED))
g_critical ("%s: signal '%s' does not support details", G_STRLOC, detailed_signal); g_warning ("%s: signal '%s' does not support details", G_STRLOC, detailed_signal);
else if (!g_type_is_a (itype, node->itype)) else if (!g_type_is_a (itype, node->itype))
g_critical ("%s: signal '%s' is invalid for instance '%p' of type '%s'", g_warning ("%s: signal '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype)); G_STRLOC, detailed_signal, instance, g_type_name (itype));
else else
{ {
@ -2616,7 +2616,7 @@ g_signal_connect_data (gpointer instance,
} }
} }
else else
g_critical ("%s: signal '%s' is invalid for instance '%p' of type '%s'", g_warning ("%s: signal '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype)); G_STRLOC, detailed_signal, instance, g_type_name (itype));
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
@ -2669,7 +2669,7 @@ signal_handler_block_unlocked (gpointer instance,
handler->block_count += 1; handler->block_count += 1;
} }
else else
g_critical ("%s: instance '%p' has no handler with id '%lu'", G_STRLOC, instance, handler_id); g_warning ("%s: instance '%p' has no handler with id '%lu'", G_STRLOC, instance, handler_id);
} }
static void static void
@ -2719,10 +2719,10 @@ signal_handler_unblock_unlocked (gpointer instance,
if (handler->block_count) if (handler->block_count)
handler->block_count -= 1; handler->block_count -= 1;
else else
g_critical (G_STRLOC ": handler '%lu' of instance '%p' is not blocked", handler_id, instance); g_warning (G_STRLOC ": handler '%lu' of instance '%p' is not blocked", handler_id, instance);
} }
else else
g_critical ("%s: instance '%p' has no handler with id '%lu'", G_STRLOC, instance, handler_id); g_warning ("%s: instance '%p' has no handler with id '%lu'", G_STRLOC, instance, handler_id);
} }
static void static void
@ -2769,7 +2769,7 @@ signal_handler_disconnect_unlocked (gpointer instance,
handler_unref_R (handler->signal_id, instance, handler); handler_unref_R (handler->signal_id, instance, handler);
} }
else else
g_critical ("%s: instance '%p' has no handler with id '%lu'", G_STRLOC, instance, handler_id); g_warning ("%s: instance '%p' has no handler with id '%lu'", G_STRLOC, instance, handler_id);
} }
/** /**
@ -3121,7 +3121,7 @@ g_signal_has_handler_pending (gpointer instance,
{ {
if (!(node->flags & G_SIGNAL_DETAILED)) if (!(node->flags & G_SIGNAL_DETAILED))
{ {
g_critical ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail); g_warning ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return FALSE; return FALSE;
} }
@ -3190,14 +3190,14 @@ g_signal_emitv (const GValue *instance_and_params,
node = LOOKUP_SIGNAL_NODE (signal_id); node = LOOKUP_SIGNAL_NODE (signal_id);
if (!node || !g_type_is_a (G_TYPE_FROM_INSTANCE (instance), node->itype)) if (!node || !g_type_is_a (G_TYPE_FROM_INSTANCE (instance), node->itype))
{ {
g_critical ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance); g_warning ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return; return;
} }
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (detail && !(node->flags & G_SIGNAL_DETAILED)) if (detail && !(node->flags & G_SIGNAL_DETAILED))
{ {
g_critical ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail); g_warning ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return; return;
} }
@ -3322,14 +3322,14 @@ g_signal_emit_valist (gpointer instance,
node = LOOKUP_SIGNAL_NODE (signal_id); node = LOOKUP_SIGNAL_NODE (signal_id);
if (!node || !g_type_is_a (G_TYPE_FROM_INSTANCE (instance), node->itype)) if (!node || !g_type_is_a (G_TYPE_FROM_INSTANCE (instance), node->itype))
{ {
g_critical ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance); g_warning ("%s: signal id '%u' is invalid for instance '%p'", G_STRLOC, signal_id, instance);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return; return;
} }
#ifndef G_DISABLE_CHECKS #ifndef G_DISABLE_CHECKS
if (detail && !(node->flags & G_SIGNAL_DETAILED)) if (detail && !(node->flags & G_SIGNAL_DETAILED))
{ {
g_critical ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail); g_warning ("%s: signal id '%u' does not support detail (%u)", G_STRLOC, signal_id, detail);
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return; return;
} }
@ -3492,7 +3492,7 @@ g_signal_emit_valist (gpointer instance,
g_value_unset (&emission_return); g_value_unset (&emission_return);
else else
{ {
g_critical ("%s: %s", G_STRLOC, error); g_warning ("%s: %s", G_STRLOC, error);
g_free (error); g_free (error);
/* we purposely leak the value here, it might not be /* we purposely leak the value here, it might not be
* in a correct state if an error condition occurred * in a correct state if an error condition occurred
@ -3530,7 +3530,7 @@ g_signal_emit_valist (gpointer instance,
&error); &error);
if (error) if (error)
{ {
g_critical ("%s: %s", G_STRLOC, error); g_warning ("%s: %s", G_STRLOC, error);
g_free (error); g_free (error);
/* we purposely leak the value here, it might not be /* we purposely leak the value here, it might not be
@ -3566,7 +3566,7 @@ g_signal_emit_valist (gpointer instance,
g_value_unset (&return_value); g_value_unset (&return_value);
else else
{ {
g_critical ("%s: %s", G_STRLOC, error); g_warning ("%s: %s", G_STRLOC, error);
g_free (error); g_free (error);
/* we purposely leak the value here, it might not be /* we purposely leak the value here, it might not be
@ -3649,7 +3649,7 @@ g_signal_emit_by_name (gpointer instance,
va_end (var_args); va_end (var_args);
} }
else else
g_critical ("%s: signal name '%s' is invalid for instance '%p' of type '%s'", g_warning ("%s: signal name '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype)); G_STRLOC, detailed_signal, instance, g_type_name (itype));
} }

View File

@ -715,25 +715,25 @@ check_plugin_U (GTypePlugin *plugin,
*/ */
if (!plugin) if (!plugin)
{ {
g_critical ("plugin handle for type '%s' is NULL", g_warning ("plugin handle for type '%s' is NULL",
type_name); type_name);
return FALSE; return FALSE;
} }
if (!G_IS_TYPE_PLUGIN (plugin)) if (!G_IS_TYPE_PLUGIN (plugin))
{ {
g_critical ("plugin pointer (%p) for type '%s' is invalid", g_warning ("plugin pointer (%p) for type '%s' is invalid",
plugin, type_name); plugin, type_name);
return FALSE; return FALSE;
} }
if (need_complete_type_info && !G_TYPE_PLUGIN_GET_CLASS (plugin)->complete_type_info) if (need_complete_type_info && !G_TYPE_PLUGIN_GET_CLASS (plugin)->complete_type_info)
{ {
g_critical ("plugin for type '%s' has no complete_type_info() implementation", g_warning ("plugin for type '%s' has no complete_type_info() implementation",
type_name); type_name);
return FALSE; return FALSE;
} }
if (need_complete_interface_info && !G_TYPE_PLUGIN_GET_CLASS (plugin)->complete_interface_info) if (need_complete_interface_info && !G_TYPE_PLUGIN_GET_CLASS (plugin)->complete_interface_info)
{ {
g_critical ("plugin for type '%s' has no complete_interface_info() implementation", g_warning ("plugin for type '%s' has no complete_interface_info() implementation",
type_name); type_name);
return FALSE; return FALSE;
} }
@ -749,7 +749,7 @@ check_type_name_I (const gchar *type_name)
if (!type_name[0] || !type_name[1] || !type_name[2]) if (!type_name[0] || !type_name[1] || !type_name[2])
{ {
g_critical ("type name '%s' is too short", type_name); g_warning ("type name '%s' is too short", type_name);
return FALSE; return FALSE;
} }
/* check the first letter */ /* check the first letter */
@ -761,12 +761,12 @@ check_type_name_I (const gchar *type_name)
strchr (extra_chars, p[0])); strchr (extra_chars, p[0]));
if (!name_valid) if (!name_valid)
{ {
g_critical ("type name '%s' contains invalid characters", type_name); g_warning ("type name '%s' contains invalid characters", type_name);
return FALSE; return FALSE;
} }
if (g_type_from_name (type_name)) if (g_type_from_name (type_name))
{ {
g_critical ("cannot register existing type '%s'", type_name); g_warning ("cannot register existing type '%s'", type_name);
return FALSE; return FALSE;
} }
@ -783,7 +783,7 @@ check_derivation_I (GType parent_type,
pnode = lookup_type_node_I (parent_type); pnode = lookup_type_node_I (parent_type);
if (!pnode) if (!pnode)
{ {
g_critical ("cannot derive type '%s' from invalid parent type '%s'", g_warning ("cannot derive type '%s' from invalid parent type '%s'",
type_name, type_name,
type_descriptive_name_I (parent_type)); type_descriptive_name_I (parent_type));
return FALSE; return FALSE;
@ -792,7 +792,7 @@ check_derivation_I (GType parent_type,
/* ensure flat derivability */ /* ensure flat derivability */
if (!(finfo->type_flags & G_TYPE_FLAG_DERIVABLE)) if (!(finfo->type_flags & G_TYPE_FLAG_DERIVABLE))
{ {
g_critical ("cannot derive '%s' from non-derivable parent type '%s'", g_warning ("cannot derive '%s' from non-derivable parent type '%s'",
type_name, type_name,
NODE_NAME (pnode)); NODE_NAME (pnode));
return FALSE; return FALSE;
@ -801,14 +801,14 @@ check_derivation_I (GType parent_type,
if (parent_type != NODE_FUNDAMENTAL_TYPE (pnode) && if (parent_type != NODE_FUNDAMENTAL_TYPE (pnode) &&
!(finfo->type_flags & G_TYPE_FLAG_DEEP_DERIVABLE)) !(finfo->type_flags & G_TYPE_FLAG_DEEP_DERIVABLE))
{ {
g_critical ("cannot derive '%s' from non-fundamental parent type '%s'", g_warning ("cannot derive '%s' from non-fundamental parent type '%s'",
type_name, type_name,
NODE_NAME (pnode)); NODE_NAME (pnode));
return FALSE; return FALSE;
} }
if ((G_TYPE_FLAG_FINAL & GPOINTER_TO_UINT (type_get_qdata_L (pnode, static_quark_type_flags))) == G_TYPE_FLAG_FINAL) if ((G_TYPE_FLAG_FINAL & GPOINTER_TO_UINT (type_get_qdata_L (pnode, static_quark_type_flags))) == G_TYPE_FLAG_FINAL)
{ {
g_critical ("cannot derive '%s' from final parent type '%s'", g_warning ("cannot derive '%s' from final parent type '%s'",
type_name, type_name,
NODE_NAME (pnode)); NODE_NAME (pnode));
return FALSE; return FALSE;
@ -843,7 +843,7 @@ check_value_table_I (const gchar *type_name,
value_table->value_peek_pointer || value_table->value_peek_pointer ||
value_table->collect_format || value_table->collect_value || value_table->collect_format || value_table->collect_value ||
value_table->lcopy_format || value_table->lcopy_value) value_table->lcopy_format || value_table->lcopy_value)
g_critical ("cannot handle uninitializable values of type '%s'", g_warning ("cannot handle uninitializable values of type '%s'",
type_name); type_name);
return FALSE; return FALSE;
} }
@ -852,25 +852,25 @@ check_value_table_I (const gchar *type_name,
if (!value_table->value_free) if (!value_table->value_free)
{ {
/* +++ optional +++ /* +++ optional +++
* g_critical ("missing 'value_free()' for type '%s'", type_name); * g_warning ("missing 'value_free()' for type '%s'", type_name);
* return FALSE; * return FALSE;
*/ */
} }
if (!value_table->value_copy) if (!value_table->value_copy)
{ {
g_critical ("missing 'value_copy()' for type '%s'", type_name); g_warning ("missing 'value_copy()' for type '%s'", type_name);
return FALSE; return FALSE;
} }
if ((value_table->collect_format || value_table->collect_value) && if ((value_table->collect_format || value_table->collect_value) &&
(!value_table->collect_format || !value_table->collect_value)) (!value_table->collect_format || !value_table->collect_value))
{ {
g_critical ("one of 'collect_format' and 'collect_value()' is unspecified for type '%s'", g_warning ("one of 'collect_format' and 'collect_value()' is unspecified for type '%s'",
type_name); type_name);
return FALSE; return FALSE;
} }
if (value_table->collect_format && !check_collect_format_I (value_table->collect_format)) if (value_table->collect_format && !check_collect_format_I (value_table->collect_format))
{ {
g_critical ("the '%s' specification for type '%s' is too long or invalid", g_warning ("the '%s' specification for type '%s' is too long or invalid",
"collect_format", "collect_format",
type_name); type_name);
return FALSE; return FALSE;
@ -878,13 +878,13 @@ check_value_table_I (const gchar *type_name,
if ((value_table->lcopy_format || value_table->lcopy_value) && if ((value_table->lcopy_format || value_table->lcopy_value) &&
(!value_table->lcopy_format || !value_table->lcopy_value)) (!value_table->lcopy_format || !value_table->lcopy_value))
{ {
g_critical ("one of 'lcopy_format' and 'lcopy_value()' is unspecified for type '%s'", g_warning ("one of 'lcopy_format' and 'lcopy_value()' is unspecified for type '%s'",
type_name); type_name);
return FALSE; return FALSE;
} }
if (value_table->lcopy_format && !check_collect_format_I (value_table->lcopy_format)) if (value_table->lcopy_format && !check_collect_format_I (value_table->lcopy_format))
{ {
g_critical ("the '%s' specification for type '%s' is too long or invalid", g_warning ("the '%s' specification for type '%s' is too long or invalid",
"lcopy_format", "lcopy_format",
type_name); type_name);
return FALSE; return FALSE;
@ -909,11 +909,11 @@ check_type_info_I (TypeNode *pnode,
(info->instance_size || info->n_preallocs || info->instance_init)) (info->instance_size || info->n_preallocs || info->instance_init))
{ {
if (pnode) if (pnode)
g_critical ("cannot instantiate '%s', derived from non-instantiatable parent type '%s'", g_warning ("cannot instantiate '%s', derived from non-instantiatable parent type '%s'",
type_name, type_name,
NODE_NAME (pnode)); NODE_NAME (pnode));
else else
g_critical ("cannot instantiate '%s' as non-instantiatable fundamental", g_warning ("cannot instantiate '%s' as non-instantiatable fundamental",
type_name); type_name);
return FALSE; return FALSE;
} }
@ -923,18 +923,18 @@ check_type_info_I (TypeNode *pnode,
info->class_size || info->base_init || info->base_finalize)) info->class_size || info->base_init || info->base_finalize))
{ {
if (pnode) if (pnode)
g_critical ("cannot create class for '%s', derived from non-classed parent type '%s'", g_warning ("cannot create class for '%s', derived from non-classed parent type '%s'",
type_name, type_name,
NODE_NAME (pnode)); NODE_NAME (pnode));
else else
g_critical ("cannot create class for '%s' as non-classed fundamental", g_warning ("cannot create class for '%s' as non-classed fundamental",
type_name); type_name);
return FALSE; return FALSE;
} }
/* check interface size */ /* check interface size */
if (is_interface && info->class_size < sizeof (GTypeInterface)) if (is_interface && info->class_size < sizeof (GTypeInterface))
{ {
g_critical ("specified interface size for type '%s' is smaller than 'GTypeInterface' size", g_warning ("specified interface size for type '%s' is smaller than 'GTypeInterface' size",
type_name); type_name);
return FALSE; return FALSE;
} }
@ -943,13 +943,13 @@ check_type_info_I (TypeNode *pnode,
{ {
if (info->class_size < sizeof (GTypeClass)) if (info->class_size < sizeof (GTypeClass))
{ {
g_critical ("specified class size for type '%s' is smaller than 'GTypeClass' size", g_warning ("specified class size for type '%s' is smaller than 'GTypeClass' size",
type_name); type_name);
return FALSE; return FALSE;
} }
if (pnode && info->class_size < pnode->data->class.class_size) if (pnode && info->class_size < pnode->data->class.class_size)
{ {
g_critical ("specified class size for type '%s' is smaller " g_warning ("specified class size for type '%s' is smaller "
"than the parent type's '%s' class size", "than the parent type's '%s' class size",
type_name, type_name,
NODE_NAME (pnode)); NODE_NAME (pnode));
@ -961,13 +961,13 @@ check_type_info_I (TypeNode *pnode,
{ {
if (info->instance_size < sizeof (GTypeInstance)) if (info->instance_size < sizeof (GTypeInstance))
{ {
g_critical ("specified instance size for type '%s' is smaller than 'GTypeInstance' size", g_warning ("specified instance size for type '%s' is smaller than 'GTypeInstance' size",
type_name); type_name);
return FALSE; return FALSE;
} }
if (pnode && info->instance_size < pnode->data->instance.instance_size) if (pnode && info->instance_size < pnode->data->instance.instance_size)
{ {
g_critical ("specified instance size for type '%s' is smaller " g_warning ("specified instance size for type '%s' is smaller "
"than the parent type's '%s' instance size", "than the parent type's '%s' instance size",
type_name, type_name,
NODE_NAME (pnode)); NODE_NAME (pnode));
@ -1008,20 +1008,20 @@ check_add_interface_L (GType instance_type,
if (!node || !node->is_instantiatable) if (!node || !node->is_instantiatable)
{ {
g_critical ("cannot add interfaces to invalid (non-instantiatable) type '%s'", g_warning ("cannot add interfaces to invalid (non-instantiatable) type '%s'",
type_descriptive_name_I (instance_type)); type_descriptive_name_I (instance_type));
return FALSE; return FALSE;
} }
if (!iface || !NODE_IS_IFACE (iface)) if (!iface || !NODE_IS_IFACE (iface))
{ {
g_critical ("cannot add invalid (non-interface) type '%s' to type '%s'", g_warning ("cannot add invalid (non-interface) type '%s' to type '%s'",
type_descriptive_name_I (iface_type), type_descriptive_name_I (iface_type),
NODE_NAME (node)); NODE_NAME (node));
return FALSE; return FALSE;
} }
if (node->data && node->data->class.class) if (node->data && node->data->class.class)
{ {
g_critical ("attempting to add an interface (%s) to class (%s) after class_init", g_warning ("attempting to add an interface (%s) to class (%s) after class_init",
NODE_NAME (iface), NODE_NAME (node)); NODE_NAME (iface), NODE_NAME (node));
return FALSE; return FALSE;
} }
@ -1029,7 +1029,7 @@ check_add_interface_L (GType instance_type,
if (NODE_PARENT_TYPE (tnode) && !type_lookup_iface_entry_L (node, tnode)) if (NODE_PARENT_TYPE (tnode) && !type_lookup_iface_entry_L (node, tnode))
{ {
/* 2001/7/31:timj: erk, i guess this warning is junk as interface derivation is flat */ /* 2001/7/31:timj: erk, i guess this warning is junk as interface derivation is flat */
g_critical ("cannot add sub-interface '%s' to type '%s' which does not conform to super-interface '%s'", g_warning ("cannot add sub-interface '%s' to type '%s' which does not conform to super-interface '%s'",
NODE_NAME (iface), NODE_NAME (iface),
NODE_NAME (node), NODE_NAME (node),
NODE_NAME (tnode)); NODE_NAME (tnode));
@ -1051,7 +1051,7 @@ check_add_interface_L (GType instance_type,
tnode = find_conforming_child_type_L (node, iface); /* tnode is_a node */ tnode = find_conforming_child_type_L (node, iface); /* tnode is_a node */
if (tnode) if (tnode)
{ {
g_critical ("cannot add interface type '%s' to type '%s', since type '%s' already conforms to interface", g_warning ("cannot add interface type '%s' to type '%s', since type '%s' already conforms to interface",
NODE_NAME (iface), NODE_NAME (iface),
NODE_NAME (node), NODE_NAME (node),
NODE_NAME (tnode)); NODE_NAME (tnode));
@ -1063,7 +1063,7 @@ check_add_interface_L (GType instance_type,
tnode = lookup_type_node_I (prerequisites[i]); tnode = lookup_type_node_I (prerequisites[i]);
if (!type_node_is_a_L (node, tnode)) if (!type_node_is_a_L (node, tnode))
{ {
g_critical ("cannot add interface type '%s' to type '%s' which does not conform to prerequisite '%s'", g_warning ("cannot add interface type '%s' to type '%s' which does not conform to prerequisite '%s'",
NODE_NAME (iface), NODE_NAME (iface),
NODE_NAME (node), NODE_NAME (node),
NODE_NAME (tnode)); NODE_NAME (tnode));
@ -1080,7 +1080,7 @@ check_interface_info_I (TypeNode *iface,
{ {
if ((info->interface_finalize || info->interface_data) && !info->interface_init) if ((info->interface_finalize || info->interface_data) && !info->interface_init)
{ {
g_critical ("interface type '%s' for type '%s' comes without initializer", g_warning ("interface type '%s' for type '%s' comes without initializer",
NODE_NAME (iface), NODE_NAME (iface),
type_descriptive_name_I (instance_type)); type_descriptive_name_I (instance_type));
return FALSE; return FALSE;
@ -1584,7 +1584,7 @@ g_type_interface_add_prerequisite (GType interface_type,
prerequisite_node = lookup_type_node_I (prerequisite_type); prerequisite_node = lookup_type_node_I (prerequisite_type);
if (!iface || !prerequisite_node || !NODE_IS_IFACE (iface)) if (!iface || !prerequisite_node || !NODE_IS_IFACE (iface))
{ {
g_critical ("interface type '%s' or prerequisite type '%s' invalid", g_warning ("interface type '%s' or prerequisite type '%s' invalid",
type_descriptive_name_I (interface_type), type_descriptive_name_I (interface_type),
type_descriptive_name_I (prerequisite_type)); type_descriptive_name_I (prerequisite_type));
return; return;
@ -1594,7 +1594,7 @@ g_type_interface_add_prerequisite (GType interface_type,
if (holders) if (holders)
{ {
G_WRITE_UNLOCK (&type_rw_lock); G_WRITE_UNLOCK (&type_rw_lock);
g_critical ("unable to add prerequisite '%s' to interface '%s' which is already in use for '%s'", g_warning ("unable to add prerequisite '%s' to interface '%s' which is already in use for '%s'",
type_descriptive_name_I (prerequisite_type), type_descriptive_name_I (prerequisite_type),
type_descriptive_name_I (interface_type), type_descriptive_name_I (interface_type),
type_descriptive_name_I (holders->instance_type)); type_descriptive_name_I (holders->instance_type));
@ -1612,7 +1612,7 @@ g_type_interface_add_prerequisite (GType interface_type,
if (prnode->is_instantiatable) if (prnode->is_instantiatable)
{ {
G_WRITE_UNLOCK (&type_rw_lock); G_WRITE_UNLOCK (&type_rw_lock);
g_critical ("adding prerequisite '%s' to interface '%s' conflicts with existing prerequisite '%s'", g_warning ("adding prerequisite '%s' to interface '%s' conflicts with existing prerequisite '%s'",
type_descriptive_name_I (prerequisite_type), type_descriptive_name_I (prerequisite_type),
type_descriptive_name_I (interface_type), type_descriptive_name_I (interface_type),
type_descriptive_name_I (NODE_TYPE (prnode))); type_descriptive_name_I (NODE_TYPE (prnode)));
@ -1638,7 +1638,7 @@ g_type_interface_add_prerequisite (GType interface_type,
else else
{ {
G_WRITE_UNLOCK (&type_rw_lock); G_WRITE_UNLOCK (&type_rw_lock);
g_critical ("prerequisite '%s' for interface '%s' is neither instantiatable nor interface", g_warning ("prerequisite '%s' for interface '%s' is neither instantiatable nor interface",
type_descriptive_name_I (prerequisite_type), type_descriptive_name_I (prerequisite_type),
type_descriptive_name_I (interface_type)); type_descriptive_name_I (interface_type));
} }
@ -1967,14 +1967,14 @@ g_type_free_instance (GTypeInstance *instance)
node = lookup_type_node_I (class->g_type); node = lookup_type_node_I (class->g_type);
if (G_UNLIKELY (!node || !node->is_instantiatable || !node->data || node->data->class.class != (gpointer) class)) if (G_UNLIKELY (!node || !node->is_instantiatable || !node->data || node->data->class.class != (gpointer) class))
{ {
g_critical ("cannot free instance of invalid (non-instantiatable) type '%s'", g_warning ("cannot free instance of invalid (non-instantiatable) type '%s'",
type_descriptive_name_I (class->g_type)); type_descriptive_name_I (class->g_type));
return; return;
} }
/* G_TYPE_IS_ABSTRACT() is an external call: _U */ /* G_TYPE_IS_ABSTRACT() is an external call: _U */
if (G_UNLIKELY (!node->mutatable_check_cache && G_TYPE_IS_ABSTRACT (NODE_TYPE (node)))) if (G_UNLIKELY (!node->mutatable_check_cache && G_TYPE_IS_ABSTRACT (NODE_TYPE (node))))
{ {
g_critical ("cannot free instance of abstract (non-instantiatable) type '%s'", g_warning ("cannot free instance of abstract (non-instantiatable) type '%s'",
NODE_NAME (node)); NODE_NAME (node));
return; return;
} }
@ -2397,7 +2397,7 @@ type_data_last_unref_Wm (TypeNode *node,
if (!node->data || NODE_REFCOUNT (node) == 0) if (!node->data || NODE_REFCOUNT (node) == 0)
{ {
g_critical ("cannot drop last reference to unreferenced type '%s'", g_warning ("cannot drop last reference to unreferenced type '%s'",
NODE_NAME (node)); NODE_NAME (node));
return; return;
} }
@ -2496,7 +2496,7 @@ type_data_unref_U (TypeNode *node,
{ {
if (!node->plugin) if (!node->plugin)
{ {
g_critical ("static type '%s' unreferenced too often", g_warning ("static type '%s' unreferenced too often",
NODE_NAME (node)); NODE_NAME (node));
return; return;
} }
@ -2584,7 +2584,7 @@ g_type_remove_class_cache_func (gpointer cache_data,
G_WRITE_UNLOCK (&type_rw_lock); G_WRITE_UNLOCK (&type_rw_lock);
if (!found_it) if (!found_it)
g_critical (G_STRLOC ": cannot remove unregistered class cache func %p with data %p", g_warning (G_STRLOC ": cannot remove unregistered class cache func %p with data %p",
cache_func, cache_data); cache_func, cache_data);
} }
@ -2658,7 +2658,7 @@ g_type_remove_interface_check (gpointer check_data,
G_WRITE_UNLOCK (&type_rw_lock); G_WRITE_UNLOCK (&type_rw_lock);
if (!found_it) if (!found_it)
g_critical (G_STRLOC ": cannot remove unregistered class check func %p with data %p", g_warning (G_STRLOC ": cannot remove unregistered class check func %p with data %p",
check_func, check_data); check_func, check_data);
} }
@ -2701,7 +2701,7 @@ g_type_register_fundamental (GType type_id,
if ((type_id & TYPE_ID_MASK) || if ((type_id & TYPE_ID_MASK) ||
type_id > G_TYPE_FUNDAMENTAL_MAX) type_id > G_TYPE_FUNDAMENTAL_MAX)
{ {
g_critical ("attempt to register fundamental type '%s' with invalid type id (%" G_GSIZE_FORMAT ")", g_warning ("attempt to register fundamental type '%s' with invalid type id (%" G_GSIZE_FORMAT ")",
type_name, type_name,
type_id); type_id);
return 0; return 0;
@ -2709,13 +2709,13 @@ g_type_register_fundamental (GType type_id,
if ((finfo->type_flags & G_TYPE_FLAG_INSTANTIATABLE) && if ((finfo->type_flags & G_TYPE_FLAG_INSTANTIATABLE) &&
!(finfo->type_flags & G_TYPE_FLAG_CLASSED)) !(finfo->type_flags & G_TYPE_FLAG_CLASSED))
{ {
g_critical ("cannot register instantiatable fundamental type '%s' as non-classed", g_warning ("cannot register instantiatable fundamental type '%s' as non-classed",
type_name); type_name);
return 0; return 0;
} }
if (lookup_type_node_I (type_id)) if (lookup_type_node_I (type_id))
{ {
g_critical ("cannot register existing fundamental type '%s' (as '%s')", g_warning ("cannot register existing fundamental type '%s' (as '%s')",
type_descriptive_name_I (type_id), type_descriptive_name_I (type_id),
type_name); type_name);
return 0; return 0;
@ -2817,7 +2817,7 @@ g_type_register_static (GType parent_type,
return 0; return 0;
if (info->class_finalize) if (info->class_finalize)
{ {
g_critical ("class finalizer specified for static type '%s'", g_warning ("class finalizer specified for static type '%s'",
type_name); type_name);
return 0; return 0;
} }
@ -2980,7 +2980,7 @@ g_type_class_ref (GType type)
node = lookup_type_node_I (type); node = lookup_type_node_I (type);
if (!node || !node->is_classed) if (!node || !node->is_classed)
{ {
g_critical ("cannot retrieve class for invalid (unclassed) type '%s'", g_warning ("cannot retrieve class for invalid (unclassed) type '%s'",
type_descriptive_name_I (type)); type_descriptive_name_I (type));
return NULL; return NULL;
} }
@ -3044,7 +3044,7 @@ g_type_class_unref (gpointer g_class)
if (node && node->is_classed && NODE_REFCOUNT (node)) if (node && node->is_classed && NODE_REFCOUNT (node))
type_data_unref_U (node, FALSE); type_data_unref_U (node, FALSE);
else else
g_critical ("cannot unreference class of invalid (unclassed) type '%s'", g_warning ("cannot unreference class of invalid (unclassed) type '%s'",
type_descriptive_name_I (class->g_type)); type_descriptive_name_I (class->g_type));
} }
@ -3069,7 +3069,7 @@ g_type_class_unref_uncached (gpointer g_class)
if (node && node->is_classed && NODE_REFCOUNT (node)) if (node && node->is_classed && NODE_REFCOUNT (node))
type_data_unref_U (node, TRUE); type_data_unref_U (node, TRUE);
else else
g_critical ("cannot unreference class of invalid (unclassed) type '%s'", g_warning ("cannot unreference class of invalid (unclassed) type '%s'",
type_descriptive_name_I (class->g_type)); type_descriptive_name_I (class->g_type));
} }
@ -3174,7 +3174,7 @@ g_type_class_peek_parent (gpointer g_class)
class = node->data->class.class; class = node->data->class.class;
} }
else if (NODE_PARENT_TYPE (node)) else if (NODE_PARENT_TYPE (node))
g_critical (G_STRLOC ": invalid class pointer '%p'", g_class); g_warning (G_STRLOC ": invalid class pointer '%p'", g_class);
return class; return class;
} }
@ -3207,7 +3207,7 @@ g_type_interface_peek (gpointer instance_class,
if (node && node->is_instantiatable && iface) if (node && node->is_instantiatable && iface)
type_lookup_iface_vtable_I (node, iface, &vtable); type_lookup_iface_vtable_I (node, iface, &vtable);
else else
g_critical (G_STRLOC ": invalid class pointer '%p'", class); g_warning (G_STRLOC ": invalid class pointer '%p'", class);
return vtable; return vtable;
} }
@ -3243,7 +3243,7 @@ g_type_interface_peek_parent (gpointer g_iface)
if (node && node->is_instantiatable && iface) if (node && node->is_instantiatable && iface)
type_lookup_iface_vtable_I (node, iface, &vtable); type_lookup_iface_vtable_I (node, iface, &vtable);
else if (node) else if (node)
g_critical (G_STRLOC ": invalid interface pointer '%p'", g_iface); g_warning (G_STRLOC ": invalid interface pointer '%p'", g_iface);
return vtable; return vtable;
} }
@ -3282,7 +3282,7 @@ g_type_default_interface_ref (GType g_type)
(node->data && NODE_REFCOUNT (node) == 0)) (node->data && NODE_REFCOUNT (node) == 0))
{ {
G_WRITE_UNLOCK (&type_rw_lock); G_WRITE_UNLOCK (&type_rw_lock);
g_critical ("cannot retrieve default vtable for invalid or non-interface type '%s'", g_warning ("cannot retrieve default vtable for invalid or non-interface type '%s'",
type_descriptive_name_I (g_type)); type_descriptive_name_I (g_type));
return NULL; return NULL;
} }
@ -3359,7 +3359,7 @@ g_type_default_interface_unref (gpointer g_iface)
if (node && NODE_IS_IFACE (node)) if (node && NODE_IS_IFACE (node))
type_data_unref_U (node, FALSE); type_data_unref_U (node, FALSE);
else else
g_critical ("cannot unreference invalid interface default vtable for '%s'", g_warning ("cannot unreference invalid interface default vtable for '%s'",
type_descriptive_name_I (vtable->g_type)); type_descriptive_name_I (vtable->g_type));
} }
@ -3848,7 +3848,7 @@ type_add_flags_W (TypeNode *node,
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
if ((flags & TYPE_FLAG_MASK) && node->is_classed && node->data && node->data->class.class) if ((flags & TYPE_FLAG_MASK) && node->is_classed && node->data && node->data->class.class)
g_critical ("tagging type '%s' as abstract after class initialization", NODE_NAME (node)); g_warning ("tagging type '%s' as abstract after class initialization", NODE_NAME (node));
dflags = GPOINTER_TO_UINT (type_get_qdata_L (node, static_quark_type_flags)); dflags = GPOINTER_TO_UINT (type_get_qdata_L (node, static_quark_type_flags));
dflags |= flags; dflags |= flags;
type_set_qdata_W (node, static_quark_type_flags, GUINT_TO_POINTER (dflags)); type_set_qdata_W (node, static_quark_type_flags, GUINT_TO_POINTER (dflags));
@ -4023,7 +4023,7 @@ g_type_interface_get_plugin (GType instance_type,
g_return_val_if_fail (node == NULL, NULL); g_return_val_if_fail (node == NULL, NULL);
g_return_val_if_fail (iface == NULL, NULL); g_return_val_if_fail (iface == NULL, NULL);
g_critical (G_STRLOC ": attempt to look up plugin for invalid instance/interface type pair."); g_warning (G_STRLOC ": attempt to look up plugin for invalid instance/interface type pair.");
return NULL; return NULL;
} }
@ -4132,16 +4132,16 @@ g_type_check_instance_cast (GTypeInstance *type_instance,
return type_instance; return type_instance;
if (is_instantiatable) if (is_instantiatable)
g_critical ("invalid cast from '%s' to '%s'", g_warning ("invalid cast from '%s' to '%s'",
type_descriptive_name_I (type_instance->g_class->g_type), type_descriptive_name_I (type_instance->g_class->g_type),
type_descriptive_name_I (iface_type)); type_descriptive_name_I (iface_type));
else else
g_critical ("invalid uninstantiatable type '%s' in cast to '%s'", g_warning ("invalid uninstantiatable type '%s' in cast to '%s'",
type_descriptive_name_I (type_instance->g_class->g_type), type_descriptive_name_I (type_instance->g_class->g_type),
type_descriptive_name_I (iface_type)); type_descriptive_name_I (iface_type));
} }
else else
g_critical ("invalid unclassed pointer in cast to '%s'", g_warning ("invalid unclassed pointer in cast to '%s'",
type_descriptive_name_I (iface_type)); type_descriptive_name_I (iface_type));
} }
@ -4165,16 +4165,16 @@ g_type_check_class_cast (GTypeClass *type_class,
return type_class; return type_class;
if (is_classed) if (is_classed)
g_critical ("invalid class cast from '%s' to '%s'", g_warning ("invalid class cast from '%s' to '%s'",
type_descriptive_name_I (type_class->g_type), type_descriptive_name_I (type_class->g_type),
type_descriptive_name_I (is_a_type)); type_descriptive_name_I (is_a_type));
else else
g_critical ("invalid unclassed type '%s' in class cast to '%s'", g_warning ("invalid unclassed type '%s' in class cast to '%s'",
type_descriptive_name_I (type_class->g_type), type_descriptive_name_I (type_class->g_type),
type_descriptive_name_I (is_a_type)); type_descriptive_name_I (is_a_type));
} }
else else
g_critical ("invalid class cast from (NULL) pointer to '%s'", g_warning ("invalid class cast from (NULL) pointer to '%s'",
type_descriptive_name_I (is_a_type)); type_descriptive_name_I (is_a_type));
return type_class; return type_class;
} }
@ -4203,14 +4203,14 @@ g_type_check_instance (GTypeInstance *type_instance)
if (node && node->is_instantiatable) if (node && node->is_instantiatable)
return TRUE; return TRUE;
g_critical ("instance of invalid non-instantiatable type '%s'", g_warning ("instance of invalid non-instantiatable type '%s'",
type_descriptive_name_I (type_instance->g_class->g_type)); type_descriptive_name_I (type_instance->g_class->g_type));
} }
else else
g_critical ("instance with invalid (NULL) class pointer"); g_warning ("instance with invalid (NULL) class pointer");
} }
else else
g_critical ("invalid (NULL) pointer instance"); g_warning ("invalid (NULL) pointer instance");
return FALSE; return FALSE;
} }
@ -4332,9 +4332,9 @@ g_type_value_table_peek (GType type)
return vtable; return vtable;
if (!node) if (!node)
g_critical (G_STRLOC ": type id '%" G_GSIZE_FORMAT "' is invalid", type); g_warning (G_STRLOC ": type id '%" G_GSIZE_FORMAT "' is invalid", type);
if (!has_refed_data) if (!has_refed_data)
g_critical ("can't peek value table for type '%s' which is not currently referenced", g_warning ("can't peek value table for type '%s' which is not currently referenced",
type_descriptive_name_I (type)); type_descriptive_name_I (type));
return NULL; return NULL;
@ -4699,7 +4699,7 @@ g_type_class_add_private (gpointer g_class,
if (!node || !node->is_instantiatable || !node->data || node->data->class.class != g_class) if (!node || !node->is_instantiatable || !node->data || node->data->class.class != g_class)
{ {
g_critical ("cannot add private field to invalid (non-instantiatable) type '%s'", g_warning ("cannot add private field to invalid (non-instantiatable) type '%s'",
type_descriptive_name_I (instance_type)); type_descriptive_name_I (instance_type));
return; return;
} }
@ -4709,7 +4709,7 @@ g_type_class_add_private (gpointer g_class,
TypeNode *pnode = lookup_type_node_I (NODE_PARENT_TYPE (node)); TypeNode *pnode = lookup_type_node_I (NODE_PARENT_TYPE (node));
if (node->data->instance.private_size != pnode->data->instance.private_size) if (node->data->instance.private_size != pnode->data->instance.private_size)
{ {
g_critical ("g_type_class_add_private() called multiple times for the same type"); g_warning ("g_type_class_add_private() called multiple times for the same type");
return; return;
} }
} }
@ -4735,14 +4735,14 @@ g_type_add_instance_private (GType class_gtype,
if (!node || !node->is_classed || !node->is_instantiatable || !node->data) if (!node || !node->is_classed || !node->is_instantiatable || !node->data)
{ {
g_critical ("cannot add private field to invalid (non-instantiatable) type '%s'", g_warning ("cannot add private field to invalid (non-instantiatable) type '%s'",
type_descriptive_name_I (class_gtype)); type_descriptive_name_I (class_gtype));
return 0; return 0;
} }
if (node->plugin != NULL) if (node->plugin != NULL)
{ {
g_critical ("cannot use g_type_add_instance_private() with dynamic type '%s'", g_warning ("cannot use g_type_add_instance_private() with dynamic type '%s'",
type_descriptive_name_I (class_gtype)); type_descriptive_name_I (class_gtype));
return 0; return 0;
} }
@ -4802,7 +4802,7 @@ g_type_class_adjust_private_offset (gpointer g_class,
if (!node || !node->is_classed || !node->is_instantiatable || !node->data) if (!node || !node->is_classed || !node->is_instantiatable || !node->data)
{ {
g_critical ("cannot add private field to invalid (non-instantiatable) type '%s'", g_warning ("cannot add private field to invalid (non-instantiatable) type '%s'",
type_descriptive_name_I (class_gtype)); type_descriptive_name_I (class_gtype));
*private_size_or_offset = 0; *private_size_or_offset = 0;
return; return;
@ -4813,7 +4813,7 @@ g_type_class_adjust_private_offset (gpointer g_class,
TypeNode *pnode = lookup_type_node_I (NODE_PARENT_TYPE (node)); TypeNode *pnode = lookup_type_node_I (NODE_PARENT_TYPE (node));
if (node->data->instance.private_size != pnode->data->instance.private_size) if (node->data->instance.private_size != pnode->data->instance.private_size)
{ {
g_critical ("g_type_add_instance_private() called multiple times for the same type"); g_warning ("g_type_add_instance_private() called multiple times for the same type");
*private_size_or_offset = 0; *private_size_or_offset = 0;
return; return;
} }
@ -4841,7 +4841,7 @@ g_type_instance_get_private (GTypeInstance *instance,
node = lookup_type_node_I (private_type); node = lookup_type_node_I (private_type);
if (G_UNLIKELY (!node || !node->is_instantiatable)) if (G_UNLIKELY (!node || !node->is_instantiatable))
{ {
g_critical ("instance of invalid non-instantiatable type '%s'", g_warning ("instance of invalid non-instantiatable type '%s'",
type_descriptive_name_I (instance->g_class->g_type)); type_descriptive_name_I (instance->g_class->g_type));
return NULL; return NULL;
} }
@ -4926,7 +4926,7 @@ g_type_add_class_private (GType class_type,
if (!node || !node->is_classed || !node->data) if (!node || !node->is_classed || !node->data)
{ {
g_critical ("cannot add class private field to invalid type '%s'", g_warning ("cannot add class private field to invalid type '%s'",
type_descriptive_name_I (class_type)); type_descriptive_name_I (class_type));
return; return;
} }
@ -4936,7 +4936,7 @@ g_type_add_class_private (GType class_type,
TypeNode *pnode = lookup_type_node_I (NODE_PARENT_TYPE (node)); TypeNode *pnode = lookup_type_node_I (NODE_PARENT_TYPE (node));
if (node->data->class.class_private_size != pnode->data->class.class_private_size) if (node->data->class.class_private_size != pnode->data->class.class_private_size)
{ {
g_critical ("g_type_add_class_private() called multiple times for the same type"); g_warning ("g_type_add_class_private() called multiple times for the same type");
return; return;
} }
} }
@ -4963,7 +4963,7 @@ g_type_class_get_private (GTypeClass *klass,
class_node = lookup_type_node_I (klass->g_type); class_node = lookup_type_node_I (klass->g_type);
if (G_UNLIKELY (!class_node || !class_node->is_classed)) if (G_UNLIKELY (!class_node || !class_node->is_classed))
{ {
g_critical ("class of invalid type '%s'", g_warning ("class of invalid type '%s'",
type_descriptive_name_I (klass->g_type)); type_descriptive_name_I (klass->g_type));
return NULL; return NULL;
} }
@ -4971,7 +4971,7 @@ g_type_class_get_private (GTypeClass *klass,
private_node = lookup_type_node_I (private_type); private_node = lookup_type_node_I (private_type);
if (G_UNLIKELY (!private_node || !NODE_IS_ANCESTOR (private_node, class_node))) if (G_UNLIKELY (!private_node || !NODE_IS_ANCESTOR (private_node, class_node)))
{ {
g_critical ("attempt to retrieve private data for invalid type '%s'", g_warning ("attempt to retrieve private data for invalid type '%s'",
type_descriptive_name_I (private_type)); type_descriptive_name_I (private_type));
return NULL; return NULL;
} }
@ -4985,7 +4985,7 @@ g_type_class_get_private (GTypeClass *klass,
if (G_UNLIKELY (private_node->data->class.class_private_size == parent_node->data->class.class_private_size)) if (G_UNLIKELY (private_node->data->class.class_private_size == parent_node->data->class.class_private_size))
{ {
g_critical ("g_type_instance_get_class_private() requires a prior call to g_type_add_class_private()"); g_warning ("g_type_instance_get_class_private() requires a prior call to g_type_add_class_private()");
return NULL; return NULL;
} }

View File

@ -101,7 +101,7 @@ g_type_module_dispose (GObject *object)
if (module->type_infos || module->interface_infos) if (module->type_infos || module->interface_infos)
{ {
g_critical (G_STRLOC ": unsolicitated invocation of g_object_run_dispose() on GTypeModule"); g_warning (G_STRLOC ": unsolicitated invocation of g_object_run_dispose() on GTypeModule");
g_object_ref (object); g_object_ref (object);
} }
@ -259,7 +259,7 @@ g_type_module_use (GTypeModule *module)
ModuleTypeInfo *type_info = tmp_list->data; ModuleTypeInfo *type_info = tmp_list->data;
if (!type_info->loaded) if (!type_info->loaded)
{ {
g_critical ("plugin '%s' failed to register type '%s'", g_warning ("plugin '%s' failed to register type '%s'",
module->name ? module->name : "(unknown)", module->name ? module->name : "(unknown)",
g_type_name (type_info->type)); g_type_name (type_info->type));
module->use_count--; module->use_count--;
@ -315,8 +315,9 @@ g_type_module_use_plugin (GTypePlugin *plugin)
if (!g_type_module_use (module)) if (!g_type_module_use (module))
{ {
g_error ("Fatal error - Could not reload previously loaded plugin '%s'", g_warning ("Fatal error - Could not reload previously loaded plugin '%s'",
module->name ? module->name : "(unknown)"); module->name ? module->name : "(unknown)");
exit (1);
} }
} }
@ -405,7 +406,7 @@ g_type_module_register_type (GTypeModule *module,
if (old_plugin != G_TYPE_PLUGIN (module)) if (old_plugin != G_TYPE_PLUGIN (module))
{ {
g_critical ("Two different plugins tried to register '%s'.", type_name); g_warning ("Two different plugins tried to register '%s'.", type_name);
return 0; return 0;
} }
} }
@ -418,7 +419,7 @@ g_type_module_register_type (GTypeModule *module,
{ {
const gchar *parent_type_name = g_type_name (parent_type); const gchar *parent_type_name = g_type_name (parent_type);
g_critical ("Type '%s' recreated with different parent type." g_warning ("Type '%s' recreated with different parent type."
"(was '%s', now '%s')", type_name, "(was '%s', now '%s')", type_name,
g_type_name (module_type_info->parent_type), g_type_name (module_type_info->parent_type),
parent_type_name ? parent_type_name : "(unknown)"); parent_type_name ? parent_type_name : "(unknown)");
@ -487,13 +488,13 @@ g_type_module_add_interface (GTypeModule *module,
if (!old_plugin) if (!old_plugin)
{ {
g_critical ("Interface '%s' for '%s' was previously registered statically or for a parent type.", g_warning ("Interface '%s' for '%s' was previously registered statically or for a parent type.",
g_type_name (interface_type), g_type_name (instance_type)); g_type_name (interface_type), g_type_name (instance_type));
return; return;
} }
else if (old_plugin != G_TYPE_PLUGIN (module)) else if (old_plugin != G_TYPE_PLUGIN (module))
{ {
g_critical ("Two different plugins tried to register interface '%s' for '%s'.", g_warning ("Two different plugins tried to register interface '%s' for '%s'.",
g_type_name (interface_type), g_type_name (instance_type)); g_type_name (interface_type), g_type_name (instance_type));
return; return;
} }

View File

@ -211,12 +211,12 @@ g_value_init (GValue *value,
value_table->value_init (value); value_table->value_init (value);
} }
else if (G_VALUE_TYPE (value)) else if (G_VALUE_TYPE (value))
g_critical ("%s: cannot initialize GValue with type '%s', the value has already been initialized as '%s'", g_warning ("%s: cannot initialize GValue with type '%s', the value has already been initialized as '%s'",
G_STRLOC, G_STRLOC,
g_type_name (g_type), g_type_name (g_type),
g_type_name (G_VALUE_TYPE (value))); g_type_name (G_VALUE_TYPE (value)));
else /* !G_TYPE_IS_VALUE (g_type) */ else /* !G_TYPE_IS_VALUE (g_type) */
g_critical ("%s: cannot initialize GValue with type '%s', %s", g_warning ("%s: cannot initialize GValue with type '%s', %s",
G_STRLOC, G_STRLOC,
g_type_name (g_type), g_type_name (g_type),
value_table ? "this type is abstract with regards to GValue use, use a more specific (derived) type" : "this type has no GTypeValueTable implementation"); value_table ? "this type is abstract with regards to GValue use, use a more specific (derived) type" : "this type has no GTypeValueTable implementation");
@ -407,7 +407,7 @@ g_value_set_instance (GValue *value,
error_msg = value_table->collect_value (value, 1, &cvalue, 0); error_msg = value_table->collect_value (value, 1, &cvalue, 0);
if (error_msg) if (error_msg)
{ {
g_critical ("%s: %s", G_STRLOC, error_msg); g_warning ("%s: %s", G_STRLOC, error_msg);
g_free (error_msg); g_free (error_msg);
/* we purposely leak the value here, it might not be /* we purposely leak the value here, it might not be
@ -471,7 +471,7 @@ g_value_init_from_instance (GValue *value,
error_msg = value_table->collect_value (value, 1, &cvalue, 0); error_msg = value_table->collect_value (value, 1, &cvalue, 0);
if (error_msg) if (error_msg)
{ {
g_critical ("%s: %s", G_STRLOC, error_msg); g_warning ("%s: %s", G_STRLOC, error_msg);
g_free (error_msg); g_free (error_msg);
/* we purposely leak the value here, it might not be /* we purposely leak the value here, it might not be

View File

@ -843,7 +843,7 @@ binding_fail (void)
G_BINDING_DEFAULT); G_BINDING_DEFAULT);
g_object_add_weak_pointer (G_OBJECT (binding), (gpointer *) &binding); g_object_add_weak_pointer (G_OBJECT (binding), (gpointer *) &binding);
g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_CRITICAL, g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING,
"*Unable to convert*double*boolean*"); "*Unable to convert*double*boolean*");
g_object_set (source, "double-value", 1.0, NULL); g_object_set (source, "double-value", 1.0, NULL);
g_test_assert_expected_messages (); g_test_assert_expected_messages ();

View File

@ -582,7 +582,7 @@ properties_testv_with_invalid_property_type (void)
} }
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed (); g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*foo*gint*gchararray*"); g_test_trap_assert_stderr ("*WARNING*foo*gint*gchararray*");
} }

View File

@ -1546,13 +1546,13 @@ test_signal_disconnect_wrong_object (void)
NULL); NULL);
/* disconnect from the wrong object (same type), should warn */ /* disconnect from the wrong object (same type), should warn */
g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_CRITICAL, g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING,
"*: instance '*' has no handler with id '*'"); "*: instance '*' has no handler with id '*'");
g_signal_handler_disconnect (object2, signal_id); g_signal_handler_disconnect (object2, signal_id);
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
/* and from an object of the wrong type */ /* and from an object of the wrong type */
g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_CRITICAL, g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING,
"*: instance '*' has no handler with id '*'"); "*: instance '*' has no handler with id '*'");
g_signal_handler_disconnect (object3, signal_id); g_signal_handler_disconnect (object3, signal_id);
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
@ -1586,7 +1586,7 @@ test_clear_signal_handler (void)
if (g_test_undefined ()) if (g_test_undefined ())
{ {
handler = g_random_int_range (0x01, 0xFF); handler = g_random_int_range (0x01, 0xFF);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*instance '* has no handler with id *'"); "*instance '* has no handler with id *'");
g_clear_signal_handler (&handler, test_obj); g_clear_signal_handler (&handler, test_obj);
g_assert_cmpuint (handler, ==, 0); g_assert_cmpuint (handler, ==, 0);
@ -1642,7 +1642,7 @@ test_lookup_invalid (void)
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed (); g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*unable to look up invalid signal name*"); g_test_trap_assert_stderr ("*WARNING*unable to look up invalid signal name*");
} }
static void static void

View File

@ -62,7 +62,7 @@ test_type_flags_final (void)
GType final2_type; GType final2_type;
/* This is the message we print out when registering the type */ /* This is the message we print out when registering the type */
g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_CRITICAL, g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING,
"*cannot derive*"); "*cannot derive*");
/* This is the message when we fail to return from the GOnce init /* This is the message when we fail to return from the GOnce init