Re: Emitting signals from threads



Hi Mitko! Can you post here the code for the button-press event handler?
It should more or less follow the code here: http://scentric.net/tutorial/sec-misc-get-renderer-from-click.html

Luca

Il giorno lun 17 dic 2018 alle ore 20:28 Mitko Haralanov via gtk-list <gtk-list gnome org> ha scritto:
Hi,

In my application, I want to be able to update a treeview from a separate thread. Each treeview row was a column that is a progress bar. The progress to be displayed is generated by a separate thread as to not block the UI.

Since GTK is not thread-safe, the way the application is written is that the thread, when it needs to emit a signal, will prepare the signal data and then call g_main_context_invoke_full(NULL, cb, data, ...) in order to be able to call g_singal_emit() in the global default context thread. The signal handler updates the tree model, which in turn updates the tree view.

For the most part this works with one big, ugly exception - the same treeview has a column, which is supposed to open the item's Edit dialog when clicked. So, naturally, I have a button-press handler connected to the treeview, which launches the Edit dialog when the button press occurs in the correct column.

However, when an update is running and the thread is continuously emitting signals, clicking on *any* column of *any* of the other items opens the Edit dialog. The treeview behaves as if the items in it have only one column.

Every example or document that I have seen in relation to signals from threads says to emit the signal from a g_idle_add() handler. However, g_main_context_invoke_full(NULL, ...) should be the same as calling g_idle_add().

Can someone shed some light into what might be happening?

Thank you.


_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list


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