Allocate/free in main thread, or just the same thread?




Hello, apologies for the basic question but the archive search mechanism
seems to still be broken.

I have multiple threads in a GTK application. Everything was working
properly when all calls to GTK were in the main thread. However, now I
have a few separate threads that needs to create some GLib objects, and then
later free them. The program aborts (sometimes) when freeing them with a
message from glib (double-frees or corrupted linked lists), or sometimes
just a crash in glib.

My question is: should glib objects only be allocated/freed in the main
program thread; or, do they just have to be freed by the same thread
that allocated them; or, are there ways to access glib from multiple
threads that I don't yet know about?

Thanks!

Reed




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]