Hi all, after spending some time investigating this issue (
https://bugzilla.gnome.org/show_bug.cgi?id=784278) where there is an
assertion failure for get_background_items in nautilus-python menu provider
extensions, I figured out what the issue is, but I'm hoping to get some
feedback from the community about how to fix it, since it will require
either changes to Nautilus or nautilus-python.

First, some history.  When I last updated nautilus-python in 2011 to work
with gobject-introspection, the nautilus extension framework was using
introspection but not annotating much, and the functions that called out
into extensions were not introspectable.  So the generated Nautilus
typelib-generated python module did not contain methods for
Nautilus.MenuProvider.get_background_items, for example.  Sometime in 2012,
annotations were added, these provider methods were made introspectable,
and all of a sudden there was a collision.

All nautilus-python extensions sub-class their provider class of choice,
like Nautilus.MenuProvider, which means they inherit
Nautilus.MenuProvider's methods.  In this case,
Nautilus.MenuProvider.get_background_items points to a C function in
libnautilus-extension/nautilus_menu_provider.c.  And if a python extension
doesn't override get_background_items, you get an assertion failure like in
the above bug ticket, because it is trying to call into a C function that
it shouldn't be calling into.

In my mind there are two ways we can fix this, but I'm open to other
solutions:

1) Update the Nautilus annotations to ensure that these calls to extension
providers are not introspectable, which would prevent collisions in
extension clases using bindings.  I'm not sure if anyone is using these
introspected calls in real life, but I don't see what use they could get
from them anyway, unless they want to pretend to be Nautilus and access
Nautilus extensions.

2) I would update nautilus-python to use a different module name (like
NautilusPython.MenuProvider.get_background_items) that would never conflict
with Nautilus's.  This would cause breakage in any existing extension.
Easy to fix, but it could catch a lot of people by surprise.

I think I would prefer #1 here, since it would probably cause the least
breakage for existing nautilus-python users.  I could deprecate
sub-classing the Nautilus module in favor of a new NautilusPython module
and eventually require it.

What do people think?
Adam
-- 
nautilus-list mailing list
nautilus-list@gnome.org
https://mail.gnome.org/mailman/listinfo/nautilus-list

Reply via email to