Opened 11 years ago

Closed 11 years ago

#529 closed Bug Report (fixed)

Infinite recursion in build_plugin_class_menu(), patch attached

Reported by: lars.luthman@… Owned by: David Robillard
Priority: blocker Component: Ingen
Keywords: Cc:

Description

When there is a loop in the plugin class inheritance tree the function build_plugin_class_menu() will get stuck in infinite recursion, causing the Ingen GUI to freeze the first time you try to bring up the canvas context menu. Ingen itself adds a loop by setting the parent class of every class without a parent, including lv2:Plugin, to lv2:Plugin, so this bug is _always_ triggered in recent SVN versions.

One way of fixing it would be to make sure that Ingen doesn't make lv2:Plugin a parent class of itself, but this still wouldn't protect against bad data (e.g. a manifest file in a plugin bundle that contains the triple "lv2:Plugin rdfs:subClassOf lv2:InstrumentPlugin."). So instead the attached patch fixes the bug by stopping the recursion in build_plugin_class_menu() whenever an inheritance loop is detected, by passing a std::set of all ancestor classes and comparing the current class to those.

Attachments (3)

build_plugin_class_menu_fix.patch (2.5 KB) - added by lars.luthman@… 11 years ago.
Bugfix
build_plugin_class_menu_fix.2.patch (2.8 KB) - added by lars.luthman@… 11 years ago.
Updated patch that actually works, broke the first one while cleaning it up
manifest.ttl (152 bytes) - added by lars.luthman@… 11 years ago.
Manifest file for bundle that triggers the bug

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by lars.luthman@…

Bugfix

Changed 11 years ago by lars.luthman@…

Updated patch that actually works, broke the first one while cleaning it up

comment:1 Changed 11 years ago by David Robillard

Hm. I don't get this problem (with unbroken data...). You get it even without loops (aside from lv2:Plugin)?

Can you paste/attach the broken bundle so I can test/compare?

comment:2 Changed 11 years ago by lars.luthman@…

I tested the SVN trunk with lv2core.lv2 as the only bundle - with revision 3 of the bundle (from the Debian package) I don't get the infinite recursion, with the provisional revision 4 from your repository I do. If I add a bundle with this as the only data in manifest.ttl:

@prefix lv2: <http://lv2plug.in/ns/lv2core#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.

lv2:Plugin rdfs:subClassOf lv2:InstrumentPlugin.

...I get infinite recursion with revision 3 of lv2core.lv2 as well. So the fix is still needed as protection against broken data, but without other broken bundles the Plugin -> Plugin loop only happens with the provisional revision 4 of lv2core.lv2. Maybe it has something to do with the new subclass relations defined in revision 4.

By the way, is there a way to tell waf to only install Ingen and its dependencies, when building the whole repository at once, other than using DESTDIR and copying the wanted files by hand?

Changed 11 years ago by lars.luthman@…

Attachment: manifest.ttl added

Manifest file for bundle that triggers the bug

comment:3 Changed 11 years ago by lars.luthman@…

The linebreaks got lost in the formatting, attached the manifest file instead.

comment:4 Changed 11 years ago by David Robillard

why on earth would anyone... :)

comment:5 Changed 11 years ago by David Robillard

Resolution: fixed
Status: newclosed

Applied in r2682 (with minor modification to print a warning when this occurs).

Thanks

Note: See TracTickets for help on using tickets.