Do not assign floating references to autoptrs
Closed this issue · 0 comments
swick commented
Operating System
XDG Desktop Portal version
1.18
XDG Desktop Portal version (Other)
No response
Desktop Environment
Other
Desktop Environment (Other)
No response
Expected Behavior
Correct use of g_autoptr
and floating refs
Current Behavior
We have a bunch of cases where we assign the result of g_variant_builder_end
to a GVariant
autoptr
which will unref the floating variant in an early exit which is an error because the reference returned is floating:
g_autoptr(GVariant) options = NULL;
...
options = g_variant_builder_end (&options_builder);
if (...)
return;
Steps to Reproduce
.
Anything else we should know?
No response