Before read : Keep in mind that i am *not* C/C++ "native" developer, and all message below can be just rant.

After little testing and debugging, i found that :
In on_editor_notify() function, user_data is not a valid pointer :
on_editor_notify(GObject *obj, gint scn, SCNotification *nt, gpointer user_data)
{
    AutocloseUserData *data = user_data;
    ...
}

After I playing for a while with this and reading demoplugin.c source, i found that in the autoclose.c, PluginCallback[] (line:829) is missing the definition for "editor-notify" event,so i added it, recompile plugin and now all seems to work correctly.

P.S.: I add the patch file as attachment to this mail, becouse for now i do not have any expiriance in commiting patches on GitHub, but tonight i will fix this big mistake :)

On 23/10/13 13:00, Lex Trotman wrote:

Looking at the line that failed, first guess would be failure to check doc is valid before using it.

Cheers
Lex


On 23 October 2013 20:20, n@sk0 <arrted...@gmail.com <mailto:arrted...@gmail.com>> wrote:

    There is strange behaviour when Auto-close plug-in is enabled.

    Steps to reproduce :
    1. open Geany
    2. Enable auto-close plug-in
    3. open several files for edit
    4. Click Ctrl+W (close document)
    --

    Expected result :
    Currently opened document is closed.
    --

    Actual result :
    Segmentation fault
    --

    See attached gdb backtrace for more info.

    Debug info :
    Geany-INFO: Geany 1.24 (git >= ef33175), en_US.UTF-8
    Geany-INFO: GTK 2.24.22, GLib 2.36.3
    Geany-INFO: System data dir: /usr/local/share/geany
    Geany-INFO: User config dir: /home/nask0/.config/geany
    Geany-INFO: System plugin path: /usr/local/lib/geany
    Geany-INFO: Added filetype CUDA (57).
    Geany-INFO: Added filetype Rust (58).
    Geany-INFO: Added filetype Scala (59).
    Geany-INFO: Added filetype Graphviz (60).
    Geany-INFO: Added filetype Cython (61).
    Geany-INFO: Added filetype Genie (62).
    Geany-INFO: Added filetype Clojure (63).
    Geany-INFO: Added filetype Go (64).
    Geany-INFO: Disabling terminal support
    Geany-INFO: Loaded:   /usr/local/lib/geany/addons.so (Addons)
    Geany-INFO: Loaded:   /usr/local/lib/geany/autoclose.so (Auto-close)
    Geany-INFO: Loaded:   /usr/local/lib/geany/geanylipsum.so
    (GeanyLipsum)
    Geany-INFO: Loaded:   /usr/local/lib/geany/geanyvc.so (GeanyVC)
    Geany-INFO: Loaded:   /usr/local/lib/geany/htmlchars.so (HTML
    Characters)
    Geany-INFO: Loaded:   /usr/local/lib/geany/geanyprj.so (Project)
    Geany-INFO: Loaded:   /usr/local/lib/geany/splitwindow.so (Split
    Window)
    Geany-INFO: Loaded:   /usr/local/lib/geany/treebrowser.so
    (TreeBrowser)
    Geany-INFO: Loaded:   /usr/local/lib/geany/xmlsnippets.so (XML
    Snippets)


    _______________________________________________
    Devel mailing list
    Devel@lists.geany.org <mailto:Devel@lists.geany.org>
    https://lists.geany.org/cgi-bin/mailman/listinfo/devel




_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel

diff --git autoclose/src/autoclose.c autoclose/src/autoclose.c
index 125fad5..26f707c 100644
--- autoclose/src/autoclose.c
+++ autoclose/src/autoclose.c
@@ -828,6 +828,7 @@ on_document_close(GObject *obj, GeanyDocument *doc, gpointer user_data)
 
 PluginCallback plugin_callbacks[] =
 {
+    { "editor-notify",  (GCallback) &on_editor_notify, FALSE, NULL },
     { "document-open",  (GCallback) &on_document_activate, FALSE, NULL },
     { "document-new",   (GCallback) &on_document_activate, FALSE, NULL },
     { "document-close", (GCallback) &on_document_close,    FALSE, NULL },
_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel

Reply via email to