From: Marty J. <mar...@co...> - 2009-06-15 03:13:23
|
The problem is that the plugin loader locates an external variable in the DSO and then assumes that the structure at that address is a PluginClass. This is not versioned, and could very easily cause a segfault or other misbehavior if there is a plugin in /usr/lib/lxpanel/plugins that isn't compiled against the headers that lxpanel is compiled against. The idea of versioning is that, at a known point at the beginning of the structure, you introduce enough data to verify and parse the part after that, which may contain extensions or optionally present things. What I'm suggesting is: At the beginning of PluginClass, introduce two variables that contain sizeof(PluginClass) and a version number. Then the plugin loader will check these in addition to what it already checks. I'd suggest a macro that does the needed initializations. Say: At the beginning of PluginClass: guint16 sizeof_structure; guint16 pluginclass_version; Plugin helper macros: #define PLUGINCLASS_VERSION 1 #define PLUGINCLASS_VERSIONING \ sizeof_structure : sizeof(PluginClass), pluginclass_version : PLUGINCLASS_VERSION The downside is that every plugin has to be edited. That is why I asked the question about the duplicated SVN directories. |