On 27-2-2011 22:01, Martin Dobias wrote:
On Sat, Feb 26, 2011 at 12:52 PM, Barend Gehrels<[email protected]> wrote:
I can imagine the API is not binary compatible for some upgrades (usually
it
is extended so then still compatible, depending on the model used). Is
there
not a mechanism to check if a plugin corresponds to the version of the
host
(qgis)? I think this is feasable...
Yes the version is available within the QGIS namespace: QGis::QGIS_VERSION
What I mean is this: adding one method to QgisPlugin, e.g.:
virtual int interfaceVersion() = 0;
which gives back a interface_version_number. That number only changes if the
(plugin) interface changes. QGis can check if the plugin does implement the
right interface.
But I now understand better that if the plugin calls back the qgis API, also
that interface has to be stable. So in practice this will indeed change with
every version. But anyway, even then, qgis can check that number as its
first action and discard that plugin if the interface_version_number is
wrong.
Exactly. This is something that should be added and checked in order
to avoid possible crashes after upgrades. Even better would be to make
it a global function in each plugin since that would avoid creation of
a new instance of that plugin which could actually make some calls to
qgis api. I would call that method e.g. 'requiredQgisVersion' and it
would always QGis::QGIS_VERSION - i.e. version of qgis used when
compiling the plugin.
Sounds perfect to me.
Regards, Barend
--
Barend Gehrels
http://about.me/barendgehrels
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer