Segfault when creating GIO GPropertyAction without properties
When creating an empty GPropertyAction
, I get a segfault.
static void
test_property_actions_no_properties (void)
{
GPropertyAction *action;
action = (GPropertyAction*) g_object_new_with_properties(G_TYPE_PROPERTY_ACTION, 0, NULL, NULL);
g_assert_true (G_IS_PROPERTY_ACTION (action));
}
The stacktrace reads:
(gdb) bt
#0 0x00007f2fd711af3f in g_property_action_set_property_name (property_name=0x0, paction=0x10bdda0) at ../gio/gpropertyaction.c:316
#1 g_property_action_set_property (object=0x10bdda0, prop_id=<optimized out>, value=<optimized out>, pspec=<optimized out>)
at ../gio/gpropertyaction.c:359
#2 0x00007f2fd722e0ec in object_set_property (object=object@entry=0x10bdda0, pspec=0x10be720, value=0x10be700, nqueue=nqueue@entry=0x0,
user_specified=<optimized out>) at ../gobject/gobject.c:1812
#3 0x00007f2fd722e970 in g_object_new_internal (class=0x10be110, params=0x0, n_params=0) at ../gobject/gobject.c:2291
#4 0x00007f2fd722fd43 in g_object_new_internal (n_params=<optimized out>, params=<optimized out>, class=<optimized out>) at ../gobject/gobject.c:2243
#5 g_object_new_with_properties (object_type=object_type@entry=17555296, n_properties=n_properties@entry=0, names=names@entry=0x0,
values=values@entry=0x0) at ../gobject/gobject.c:2409
#6 0x0000000000406c17 in test_property_actions_no_properties () at ../gio/tests/actions.c:1404
#7 0x00007f2fd72f2cbe in test_case_run (tc=0x10b7ce0) at ../glib/gtestutils.c:3114
#8 g_test_run_suite_internal (suite=suite@entry=0x10b7030, path=path@entry=0x0) at ../glib/gtestutils.c:3209
#9 0x00007f2fd72f2ab3 in g_test_run_suite_internal (suite=suite@entry=0x10b6f10, path=path@entry=0x0) at ../glib/gtestutils.c:3228
#10 0x00007f2fd72f31d2 in g_test_run_suite (suite=suite@entry=0x10b6f10) at ../glib/gtestutils.c:3308
#11 0x00007f2fd72f3258 in g_test_run () at ../glib/gtestutils.c:2415
#12 0x0000000000403a16 in main (argc=<optimized out>, argv=<optimized out>) at ../gio/tests/actions.c:1427
I would expect that either the object is created, or no object is created and an error is raised.
I created a branch with that exposes the error: https://gitlab.gnome.org/amolenaar/glib/-/commits/crash-property-action.
Original issue: pygobject#586 (closed)
Edited by Arjan Molenaar