mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
printoperation: fix case where operation may complete multiple twice
If we are the final backend, then after removing ourselves there is no backend remaining. We will schedule the idle even if it has already been scheduled. This idle is required to run exactly once and executing it twices results in a double free that crashes loupe when printing. It also causes the user callback to execute twice, which could cause similar problems. Fixes #6122
This commit is contained in:
parent
79ebd76ac8
commit
d8c821a851
@ -1135,7 +1135,10 @@ printer_list_done_cb (GtkPrintBackend *backend,
|
||||
gtk_print_backend_destroy (backend);
|
||||
g_object_unref (backend);
|
||||
|
||||
if (finder->backends == NULL)
|
||||
/* If there are no more backends left after removing ourselves from the list
|
||||
* above, then we're finished.
|
||||
*/
|
||||
if (finder->backends == NULL && !finder->found_printer)
|
||||
g_idle_add (find_printer_idle, finder);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user