[geany/geany-plugins] fdcf8f: pairtaghighliter: Fix crash on plugin unload
Colomban Wendling
git-noreply at xxxxx
Thu May 9 22:28:58 UTC 2013
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Thu, 09 May 2013 22:28:58 UTC
Commit: fdcf8f8d08983f1f7e63b8b5a0492d3765e9e7ba
https://github.com/geany/geany-plugins/commit/fdcf8f8d08983f1f7e63b8b5a0492d3765e9e7ba
Log Message:
-----------
pairtaghighliter: Fix crash on plugin unload
Fix crash on plugin unload if the plugin didn't run on any editor, or
if the last editor it ran on became invalid.
The global 'sci' variable wasn't set in 'plugin_cleanup()' and thus may
either have been uninitialized or initialized to a value not valid
anymore.
The simplest way to reproduce the crash was to load and then
immediately unload the plugin, without leaving the plugin manager
dialog.
Modified Paths:
--------------
pairtaghighlighter/src/pair_tag_highlighter.c
Modified: pairtaghighlighter/src/pair_tag_highlighter.c
10 files changed, 8 insertions(+), 2 deletions(-)
===================================================================
@@ -344,6 +344,12 @@ void plugin_init(GeanyData *data)
void plugin_cleanup(void)
{
- clear_previous_highlighting(highlightedBrackets[0], highlightedBrackets[1]);
- clear_previous_highlighting(highlightedBrackets[2], highlightedBrackets[3]);
+ GeanyDocument *doc = document_get_current();
+
+ if (doc)
+ {
+ sci = doc->editor->sci;
+ clear_previous_highlighting(highlightedBrackets[0], highlightedBrackets[1]);
+ clear_previous_highlighting(highlightedBrackets[2], highlightedBrackets[3]);
+ }
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list