diff --git a/ChangeLog b/ChangeLog index 4cf0f3f2d..ea465979e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ Add ui_combo_box_add_to_history() to API. * plugins/filebrowser.c: Add history to path entry. + * src/plugindata.h, src/plugins.c, doc/plugins.dox: + Fix not loading plugins built against a newer API when Geany doesn't + provide the required version given in PLUGIN_VERSION_CHECK(). + Improve documentation for PLUGIN_VERSION_CHECK(). 2010-06-17 Nick Treleaven diff --git a/doc/plugins.dox b/doc/plugins.dox index df156eb79..b61fd92d2 100644 --- a/doc/plugins.dox +++ b/doc/plugins.dox @@ -43,7 +43,7 @@ * @section pluginsupport Plugin Support * - @link howto Plugin HowTo @endlink - get started * - @link pluginsymbols.c Plugin Symbols @endlink - * - @link plugindata.h Main Datatypes and Macros @endlink + * - @link plugindata.h Plugin Datatypes and Macros @endlink * - @link signals Plugin Signals @endlink * - @link pluginutils.h Plugin Utility Functions @endlink * - @link guidelines Plugin Writing Guidelines @endlink diff --git a/src/plugindata.h b/src/plugindata.h index 1718a116a..da32dc8c1 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -59,18 +59,20 @@ enum { GEANY_ABI_VERSION = 66 }; -/** Checks the plugin can be loaded by Geany. +/** Defines a function to check the plugin is safe to load. * This performs runtime checks that try to ensure: * - Geany ABI data types are compatible with this plugin. - * - Geany sources provide the required API for this plugin. */ + * - Geany sources provide the required API for this plugin. + * @param api_required The minimum API number your plugin requires. + * Look at the source for the value of @c GEANY_API_VERSION to use if you + * want your plugin to require the current Geany version on your machine. + * You should update this value when using any new API features. */ #define PLUGIN_VERSION_CHECK(api_required) \ gint plugin_version_check(gint abi_ver) \ { \ if (abi_ver != GEANY_ABI_VERSION) \ return -1; \ - if (GEANY_API_VERSION < (api_required)) \ - return (api_required); \ - else return 0; \ + return (api_required); \ } diff --git a/src/plugins.c b/src/plugins.c index 9c46adabb..d8827e6d9 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -468,7 +468,7 @@ plugin_check_version(GModule *module) "release of Geany - recompile it.", g_module_name(module)); return FALSE; } - if (result > 0) + if (result > GEANY_API_VERSION) { geany_debug("Plugin \"%s\" requires a newer version of Geany (API >= v%d).", g_module_name(module), result);