GNOME Bugzilla – Bug 743857
gtk_enumerate_printers can't be run from a thread
Last modified: 2018-02-10 08:06:07 UTC
Created attachment 295947 [details] Test case example The problem is that the sources used by the cups backend are always attached to the default main context. I want gtk_enumerate_printers to wait until done, but without using the default main context, because this will end up processing sources of my application. I really want the application to wait without processing sources, until the printer enumeration is done. So, I want to run a thread I can join from the main thread that calls gtk_enumerate_printers with wait=False, and use my own main loop and context. See attached the test case.
Created attachment 295949 [details] [review] Patch Without the patch the thread never finishes, because the enumeration is attaching sources to the main context that is busy waiting for the thread to finish. With this patch the cups sources are attached to worker thread main context.
See https://bugs.webkit.org/show_bug.cgi?id=141035#c14 for an explanation of why I need this.
I'm reconsidering this . . . There are more places where GSources are attached to the default main context, the cups authentication dialog doesn't make things easy to run this in a thread either, and the fact that a possible third-party print backend might use the default main context makes it very risky to use a worker thread for gtk_enumerate_printer and join in it in the main thread. I've used a different approach for WebKit in the end.
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.