mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 13:30:28 +01:00
libnm-glib: fix assertion-failure messages in test-remote-settings-client
test-remote-setting-client uses a macro:
#define test_assert(condition) \
do { \
if (!G_LIKELY (condition)) \
cleanup (); \
g_assert (condition); \
} while (0)
where cleanup() kills the fake remote-settings service and unrefs
settings. However, in many cases, "condition" would involve a test
against a connection that was owned by settings, so if the check
failed, the connection would end up getting freed by cleanup(), and so
then the second invocation of condition would result in the program
aborting on a failed check somewhere else (eg, "invalid unclassed
pointer in cast to 'NMConnection'") rather than displaying the failed
assertion that had gotten us to that point.
Fix this by not unreffing settings from cleanup(); in the normal exit
case we can just have main() unref it, and in the assertion-failed
case, we don't need to free things anyway.
This commit is contained in:
parent
bcd554724e
commit
396610d14a
1 changed files with 1 additions and 2 deletions
|
|
@ -44,8 +44,6 @@ NMRemoteConnection *remote = NULL;
|
|||
static void
|
||||
cleanup (void)
|
||||
{
|
||||
if (settings)
|
||||
g_object_unref (settings);
|
||||
kill (spid, SIGTERM);
|
||||
}
|
||||
|
||||
|
|
@ -392,6 +390,7 @@ main (int argc, char **argv)
|
|||
ret = g_test_run ();
|
||||
|
||||
cleanup ();
|
||||
g_object_unref (settings);
|
||||
dbus_g_connection_unref (bus);
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue