[Geany-Devel] New plugin loader mechanisms

Thomas Martitz kugel at xxxxx
Fri Mar 27 08:24:50 UTC 2015


Am 26.03.2015 um 18:47 schrieb Dimitar Zhekov:
> On 26.3.2015 г. 01:16, Thomas Martitz wrote:
>
>>> Now, do we really want the plugins to run arbitrary resource checking
>>> code, and display their own error messages, only because they are
>>> queried (or registered, as you put it), each time the list is build?
>
>> Yes plugins should be able to run arbitrary checking code because that's
>> necessary for proxy plugins. Whether Geany can provide APIs to report
>> results to a the user in a consistent manner is on another piece of
>> paper, one that's IMO slightly out of scope for my proposal.
>
> From your initial proposal:
>
> "The plugin defines a single global function, 
> geany_load_module(GeanyPlugin *, GModule *). This is the only function 
> that geany learns about using g_module_symbol(). And the only thing 
> this function ought to do is to call geany_plugin_register()."
>
> As a non-Englisher, I read this as "the only thing must / should / is 
> supposed / is preferable", and am not sure which one. Some of the 
> meanings contradict "should be able to run arbitrary checking code".

Right, I changed my mind. As I already wrote in an earlier mail in 
response to you:
"I said in my proposal it should do nothing but call 
geany_register_plugin(), but I guess we can relax that by allowing also 
for testing if the plugin itself is operational. "

>
>>> But nobody can guarantee that it exists and is valid on init. [...]
>>> how am I supposed to react - just crash? If init remains void,
>>> then it would be no better than the current void plugin_init(), and
>>> I'll simply check anything in load - why bother, if I *still* need to
>>> manually disable scope on initialization failure?
>>
>> What do you do currently?
>
> Emit a message in Status() + g_warning() and stop further init, plus 
> check in cleanup(). A popup or status bar message would be acceptable 
> too, since it's only if the plugin is actually activated, unlike any 
> possible check in geany_load_module().


If the checks are in geany_load_module() the plugin couldn't even be 
activated. Which is IMO desirable.


>
>> I also tend to think that a failing init is misdesigned.  [...]
> > However keep in mind that init can be called without prior call to
> > geany_load_module(), if the user toggles plugins in the PM dialog.
>
> Under the current loading mechanism, a plugin is re-loaded with 
> g_module_open() on each toggle. If you intend to change that, you'll 
> break any global variable initializations in all plugins, most 
> importantly the assumption that a global C variable is automatically 
> set to zero.

I don't intend to change this.




More information about the Devel mailing list