[gedit] Initialize and shutdown the modelines data dir once. Fixes bug #626343.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Initialize and shutdown the modelines data dir once. Fixes bug #626343.
- Date: Tue, 17 Aug 2010 07:01:13 +0000 (UTC)
commit b8b6fe708eddd6a9d471ecd04c38e790d8c0bc7c
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Aug 17 08:58:21 2010 +0200
Initialize and shutdown the modelines data dir once. Fixes bug #626343.
For each view we initialize the modeline parser, but it is only needed
to be done once. This patch fixes the problem. Thanks to Ralf Ebert
for pointing this out.
plugins/modelines/gedit-modeline-plugin.c | 4 ++--
plugins/modelines/modeline-parser.c | 6 +++++-
2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plugins/modelines/gedit-modeline-plugin.c b/plugins/modelines/gedit-modeline-plugin.c
index 9c23645..c67a01d 100644
--- a/plugins/modelines/gedit-modeline-plugin.c
+++ b/plugins/modelines/gedit-modeline-plugin.c
@@ -156,13 +156,13 @@ static void
gedit_modeline_plugin_activate (GeditViewActivatable *activatable)
{
GeditModelinePlugin *plugin;
- GtkTextBuffer *doc;
+ GtkTextBuffer *doc;
gedit_debug (DEBUG_PLUGINS);
plugin = GEDIT_MODELINE_PLUGIN (activatable);
- doc = gtk_text_view_get_buffer (GTK_TEXT_VIEW (plugin->priv->view));
+ doc = gtk_text_view_get_buffer (GTK_TEXT_VIEW (plugin->priv->view));
plugin->priv->document_loaded_handler_id =
g_signal_connect (doc, "loaded",
diff --git a/plugins/modelines/modeline-parser.c b/plugins/modelines/modeline-parser.c
index 857d377..7fad276 100644
--- a/plugins/modelines/modeline-parser.c
+++ b/plugins/modelines/modeline-parser.c
@@ -79,7 +79,10 @@ 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 +102,7 @@ modeline_parser_shutdown ()
kate_languages = NULL;
g_free (modelines_data_dir);
+ modelines_data_dir = NULL;
}
static GHashTable *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]