[gedit] Ref the doc while querying info so that is not finalized.
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Ref the doc while querying info so that is not finalized.
- Date: Sat, 27 Feb 2010 11:35:33 +0000 (UTC)
commit a0aa52ae1b6bde8febe89539b70f1ef5b002af22
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Feb 27 11:29:06 2010 +0100
Ref the doc while querying info so that is not finalized.
gedit/gedit-document.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 17183fa..325ebe0 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -953,12 +953,13 @@ query_info_cb (GFile *source,
if (error->code != G_FILE_ERROR_ISDIR)
g_warning ("%s", error->message);
g_error_free (error);
-
- return;
+ }
+ else
+ {
+ on_content_type_changed (doc, NULL, NULL);
}
-
- on_content_type_changed (doc, NULL, NULL);
+ g_object_unref (doc);
}
#endif
@@ -990,16 +991,18 @@ set_uri (GeditDocument *doc,
/* Get the GFileInfo async so we can set the language from the metadata */
location = gedit_document_get_location (doc);
-
+
if (location != NULL)
{
+ /* ref the doc so that is not finalized before the
+ * query info callback runs */
g_file_query_info_async (location,
METADATA_QUERY,
G_FILE_QUERY_INFO_NONE,
G_PRIORITY_DEFAULT,
NULL,
(GAsyncReadyCallback) query_info_cb,
- doc);
+ g_object_ref (doc));
g_object_unref (location);
}
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]