[geany/geany-plugins] dbb833: geanynumberedbookmarks: Don't leave dangling GObject data items

Colomban Wendling git-noreply at xxxxx
Thu Dec 20 13:09:34 UTC 2018


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Thu, 20 Dec 2018 13:09:34 UTC
Commit:      dbb83301bac2807c166e2511a912002cb3971b1e
             https://github.com/geany/geany-plugins/commit/dbb83301bac2807c166e2511a912002cb3971b1e

Log Message:
-----------
geanynumberedbookmarks: Don't leave dangling GObject data items

When unloading the plugin properly remove the GObject data it has set
on documents.  This avoids leaving dangling pointers to freed memory a
subsequent re-loading of the plugin will try and use, leading to a
crash.

Fixes #803.


Modified Paths:
--------------
    geanynumberedbookmarks/src/geanynumberedbookmarks.c

Modified: geanynumberedbookmarks/src/geanynumberedbookmarks.c
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -1554,7 +1554,9 @@ void plugin_cleanup(void)
 	for(i=0;i<GEANY(documents_array)->len;i++)
 		if(documents[i]->is_valid) {
 			sci=documents[i]->editor->sci;
-			markers=GetMarkersUsed(sci);
+			markers=g_object_steal_data(G_OBJECT(sci), "Geany_Numbered_Bookmarks_Used");
+			if(!markers)
+				continue;
 			for(k=2;k<25;k++)
 				if(((*markers)&(1<<k))!=0)
 					scintilla_send_message(sci,SCI_MARKERDELETEALL,k,0);



--------------
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