mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
placesview: keep reference during network fetching
Analogous to (un)mount operation, we now keep a reference around during the ongoing operation and make use of the destroyed flag to check if we are still alive or if we have been cancelled as a result of the widget being destroyed. https://bugzilla.gnome.org/show_bug.cgi?id=764979
This commit is contained in:
parent
7cdc04c8d2
commit
d4bf215611
@ -970,8 +970,11 @@ network_enumeration_next_files_finished (GObject *source_object,
|
|||||||
g_list_free_full (detected_networks, g_object_unref);
|
g_list_free_full (detected_networks, g_object_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* avoid to update widgets if the operation was cancelled in finalize */
|
g_object_unref (view);
|
||||||
if (priv->listbox != NULL)
|
|
||||||
|
/* avoid to update widgets if we are already destroyed
|
||||||
|
(and got cancelled s a result of that) */
|
||||||
|
if (!priv->destroyed)
|
||||||
{
|
{
|
||||||
update_network_state (view);
|
update_network_state (view);
|
||||||
update_loading (view);
|
update_loading (view);
|
||||||
@ -997,6 +1000,7 @@ network_enumeration_finished (GObject *source_object,
|
|||||||
g_warning ("Failed to fetch network locations: %s", error->message);
|
g_warning ("Failed to fetch network locations: %s", error->message);
|
||||||
|
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
g_object_unref (GTK_PLACES_VIEW (user_data));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1036,6 +1040,7 @@ fetch_networks (GtkPlacesView *view)
|
|||||||
gtk_places_view_set_fetching_networks (view, TRUE);
|
gtk_places_view_set_fetching_networks (view, TRUE);
|
||||||
update_network_state (view);
|
update_network_state (view);
|
||||||
|
|
||||||
|
g_object_ref (view);
|
||||||
g_file_enumerate_children_async (network_file,
|
g_file_enumerate_children_async (network_file,
|
||||||
"standard::type,standard::target-uri,standard::name,standard::display-name,standard::icon",
|
"standard::type,standard::target-uri,standard::name,standard::display-name,standard::icon",
|
||||||
G_FILE_QUERY_INFO_NONE,
|
G_FILE_QUERY_INFO_NONE,
|
||||||
|
Loading…
Reference in New Issue
Block a user