Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cfg/gtk.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@
<alloc init="true" no-fail="true">g_app_info_get_default_for_uri_scheme</alloc>
<alloc init="true" no-fail="true">g_application_new</alloc>
<alloc init="true" no-fail="true">g_application_get_dbus_connection</alloc>
<alloc init="true" no-fail="true">g_application_get_default</alloc>
<alloc init="true" no-fail="true">g_buffered_input_stream_new</alloc>
<alloc init="true" no-fail="true">g_buffered_output_stream_new</alloc>
<alloc init="true" no-fail="true">g_cancellable_new</alloc>
Expand Down Expand Up @@ -926,6 +925,12 @@
<use>g_file_attribute_matcher_ref</use>
<dealloc>g_file_attribute_matcher_unref</dealloc>
</memory>
<function name="g_application_get_default">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have use-retval?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so, in the sense that it's pointless to call this function and ignore the return value (so it's not as serious as ignoring the return value of g_list_prepend, for example). I’ve added it, along with the return type.

<leak-ignore/>
<noreturn>false</noreturn>
<returnValue type="GApplication *"/>
<use-retval/>
</function>
<function name="g_exit">
<noreturn>true</noreturn>
</function>
Expand Down
4 changes: 4 additions & 0 deletions test/cfg/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ void validCode(int argInt, GHashTableIter * hash_table_iter, GHashTable * hash_t
// cppcheck-suppress valueFlowBailout // TODO: caused by <pure/>?
printf("%s", str);
g_free(str);

// transfer none functions: return value should not be unreffed
const GApplication *app = g_application_get_default();
printf("%p\n", app);
}

void g_malloc_test()
Expand Down