mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
app: implement error handling in gimp_imagefile_icon_callback()
Particularly, don't crash if the async operation got cancelled in dispose().
This commit is contained in:
parent
ab607a0adc
commit
dd0042f76b
1 changed files with 25 additions and 6 deletions
|
@ -626,22 +626,41 @@ gimp_imagefile_icon_callback (GObject *source_object,
|
|||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImagefile *imagefile = GIMP_IMAGEFILE (data);
|
||||
GimpImagefilePrivate *private = GET_PRIVATE (imagefile);
|
||||
GFile *file = G_FILE (source_object);
|
||||
GError *error = NULL;
|
||||
GimpImagefile *imagefile;
|
||||
GimpImagefilePrivate *private;
|
||||
GFile *file = G_FILE (source_object);
|
||||
GError *error = NULL;
|
||||
GFileInfo *file_info;
|
||||
|
||||
file_info = g_file_query_info_finish (file, result, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
/* we were cancelled from dispose() and the imagefile is
|
||||
* long gone, bail out
|
||||
*/
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
{
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef GIMP_UNSTABLE
|
||||
g_printerr ("%s: %s\n", G_STRFUNC, error->message);
|
||||
#endif
|
||||
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
imagefile = GIMP_IMAGEFILE (data);
|
||||
private = GET_PRIVATE (imagefile);
|
||||
|
||||
if (file_info)
|
||||
{
|
||||
private->icon = g_object_ref (g_file_info_get_icon (file_info));
|
||||
g_object_unref (file_info);
|
||||
}
|
||||
|
||||
g_clear_error (&error);
|
||||
|
||||
if (private->icon_cancellable)
|
||||
{
|
||||
g_object_unref (private->icon_cancellable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue