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
36 changes: 35 additions & 1 deletion cfg/gtk.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8385,9 +8385,43 @@
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<!-- GThread * g_thread_new (const gchar *name, GThreadFunc func, gpointer data); -->
<function name="g_thread_new">
<noreturn>false</noreturn>
<returnValue type="GThread *"/>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="3" direction="in"/>
</function>
<!-- GThread * g_thread_try_new (const gchar *name, GThreadFunc func, gpointer data, GError **error); -->
<function name="g_thread_try_new">
<noreturn>false</noreturn>
<returnValue type="GThread *"/>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="3" direction="in"/>
<arg nr="4" direction="out"/>
</function>
<!-- gpointer g_thread_join (GThread *thread); -->
<function name="g_thread_join">
<leak-ignore/>
<noreturn>false</noreturn>
<returnValue type="gpointer"/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
</arg>
</function>
<function name="g_thread_pool_get_max_threads">
<leak-ignore/>
Expand Down
24 changes: 24 additions & 0 deletions test/cfg/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,3 +730,27 @@ int g_define_enum_and_flags_type_test(void) {
return e + f;
}
#endif

static gpointer thread_func(gpointer data)
{
return data;
}

void g_thread_join_releases_thread_test(void)
{
// cppcheck-suppress [constVariablePointer, unusedAllocatedMemory]
GThread *thread = g_thread_new("test", thread_func, NULL);
g_thread_join(thread);

// cppcheck-suppress constVariablePointer
GThread *thread_try = g_thread_try_new("test", thread_func, NULL, NULL);
if (thread_try)
g_thread_join(thread_try);
}

void g_thread_not_joined_test(void)
{
GThread *thread = g_thread_new("test", thread_func, NULL);
(void)thread;
// cppcheck-suppress memleak
}
Loading