mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
tests: Fix two small leaks in the actions test
These are known leaks, as they were being done in tests which were checking precondition failures. However, since we know what happens when the failures occur, we can still free the input data reliably, so do that. This improves the valgrind output for `actions` to show zero definite leaks. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
c8fa295f6a
commit
4eafbaba94
@ -275,10 +275,12 @@ test_stateful (void)
|
|||||||
|
|
||||||
if (g_test_undefined ())
|
if (g_test_undefined ())
|
||||||
{
|
{
|
||||||
|
GVariant *new_state = g_variant_ref_sink (g_variant_new_int32 (123));
|
||||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
|
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
|
||||||
"*assertion*g_variant_is_of_type*failed*");
|
"*assertion*g_variant_is_of_type*failed*");
|
||||||
g_simple_action_set_state (action, g_variant_new_int32 (123));
|
g_simple_action_set_state (action, new_state);
|
||||||
g_test_assert_expected_messages ();
|
g_test_assert_expected_messages ();
|
||||||
|
g_variant_unref (new_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_simple_action_set_state (action, g_variant_new_string ("hello"));
|
g_simple_action_set_state (action, g_variant_new_string ("hello"));
|
||||||
@ -292,10 +294,12 @@ test_stateful (void)
|
|||||||
|
|
||||||
if (g_test_undefined ())
|
if (g_test_undefined ())
|
||||||
{
|
{
|
||||||
|
GVariant *new_state = g_variant_ref_sink (g_variant_new_int32 (123));
|
||||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
|
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
|
||||||
"*assertion*!= NULL*failed*");
|
"*assertion*!= NULL*failed*");
|
||||||
g_simple_action_set_state (action, g_variant_new_int32 (123));
|
g_simple_action_set_state (action, new_state);
|
||||||
g_test_assert_expected_messages ();
|
g_test_assert_expected_messages ();
|
||||||
|
g_variant_unref (new_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (action);
|
g_object_unref (action);
|
||||||
|
Loading…
Reference in New Issue
Block a user