Blob Blame Raw
From 910aec06b34eed2aacbdf4f138f1ba38605c249a Mon Sep 17 00:00:00 2001
From: monsta <monsta@inbox.ru>
Date: Mon, 27 Mar 2017 15:32:25 +0300
Subject: [PATCH] modelines: fix random crash on closing one of several Pluma
 windows

ported from:
https://git.gnome.org/browse/gedit/commit/?id=b8b6fe708eddd6a9d471ecd04c38e790d8c0bc7c
---
 plugins/modelines/modeline-parser.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins/modelines/modeline-parser.c b/plugins/modelines/modeline-parser.c
index f816f95..c66c1ed 100644
--- a/plugins/modelines/modeline-parser.c
+++ b/plugins/modelines/modeline-parser.c
@@ -79,7 +79,8 @@ has_option (ModelineOptions *options,
 void
 modeline_parser_init (const gchar *data_dir)
 {
-	modelines_data_dir = g_strdup (data_dir);
+	if (modelines_data_dir == NULL)
+		modelines_data_dir = g_strdup (data_dir);
 }
 
 void
@@ -99,6 +100,7 @@ modeline_parser_shutdown ()
 	kate_languages = NULL;
 
 	g_free (modelines_data_dir);
+	modelines_data_dir = NULL;
 }
 
 static GHashTable *
-- 
2.12.1