[gedit-code-assistance] Fix crash when closing several documents
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-code-assistance] Fix crash when closing several documents
- Date: Thu, 19 Mar 2015 15:57:39 +0000 (UTC)
commit 7c562e35d952b42febd4c76fa9ef7ba872d56788
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Mar 19 16:57:22 2015 +0100
Fix crash when closing several documents
src/gca-backend.vala | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/src/gca-backend.vala b/src/gca-backend.vala
index 5254754..64862e5 100644
--- a/src/gca-backend.vala
+++ b/src/gca-backend.vala
@@ -197,8 +197,16 @@ class Backend : Object
{
unsaved_document.begin(view, (obj, res) => {
var data_path = unsaved_document.end(res);
- var path = view.document.path;
- var cursor = view.document.cursor;
+
+ var doc = view.document;
+ if (doc == null) {
+ // This happens when a document has been closed while we're
+ // getting the unsaved document
+ return;
+ }
+
+ var path = doc.path;
+ var cursor = doc.cursor;
var options = new HashTable<string, Variant>(str_hash, str_equal);
@@ -235,8 +243,15 @@ class Backend : Object
open_documents.begin(view, (obj, res) => {
var docs = open_documents.end(res);
- var path = view.document.path;
- var cursor = view.document.cursor;
+ var doc = view.document;
+ if (doc == null) {
+ // This happens when a document has been closed while we're
+ // opening the documents
+ return;
+ }
+
+ var path = doc.path;
+ var cursor = doc.cursor;
var options = new HashTable<string, Variant>(str_hash, str_equal);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]