Ticket #529: build_plugin_class_menu_fix.patch

File build_plugin_class_menu_fix.patch, 2.5 KB (added by lars.luthman@…, 11 years ago)

Bugfix

  • ingen/src/gui/PatchCanvas.cpp

    diff --git a/ingen/src/gui/PatchCanvas.cpp b/ingen/src/gui/PatchCanvas.cpp
    index 1b6defc..5e43c62 100644
    a b PatchCanvas::build_menus() 
    184184 */
    185185size_t
    186186PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu,
    187         SLV2PluginClass plugin_class, SLV2PluginClasses classes, const LV2Children& children)
     187                     SLV2PluginClass plugin_class, SLV2PluginClasses classes, const LV2Children& children, std::set<char const*>& ancestors)
    188188{
    189189    size_t      num_items     = 0;
    190190    SLV2Value   class_uri     = slv2_plugin_class_get_uri(plugin_class);
    PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, 
    197197        return 0;
    198198
    199199    // Add submenus
     200    ancestors.insert(class_uri_str);
    200201    for (LV2Children::const_iterator i = kids.first; i != kids.second; ++i) {
    201202        SLV2PluginClass c = i->second;
    202203        const char* sub_label_str = slv2_value_as_string(slv2_plugin_class_get_label(c));
    PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, 
    209210        Gtk::Menu* submenu = Gtk::manage(new Gtk::Menu());
    210211        menu_item->set_submenu(*submenu);
    211212
    212         size_t num_child_items = build_plugin_class_menu(submenu, c, classes, children);
     213        size_t num_child_items = build_plugin_class_menu(submenu, c, classes, children, ancestors);
    213214
    214215        _class_menus.insert(make_pair(sub_uri_str, MenuRecord(menu_item, submenu)));
    215216        if (num_child_items == 0)
    PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, 
    217218
    218219        ++num_items;
    219220    }
     221    ancestors.erase(class_uri_str);
    220222
    221223    return num_items;
    222224}
    PatchCanvas::build_plugin_menu() 
    248250            p = slv2_plugin_class_get_uri(lv2_plugin);
    249251        children.insert(make_pair(slv2_value_as_string(p), c));
    250252    }
    251     build_plugin_class_menu(_plugin_menu, lv2_plugin, classes, children);
     253    std::set<char const*> ancestors;
     254    build_plugin_class_menu(_plugin_menu, lv2_plugin, classes, children, ancestors);
    252255}
    253256
    254257#endif
  • ingen/src/gui/PatchCanvas.hpp

    diff --git a/ingen/src/gui/PatchCanvas.hpp b/ingen/src/gui/PatchCanvas.hpp
    index ae99c1c..aa27c9e 100644
    a b  
    2020
    2121#include <string>
    2222#include <map>
     23#include <set>
    2324#include <boost/shared_ptr.hpp>
    2425#include "ingen-config.h"
    2526#include "flowcanvas/Canvas.hpp"
    private: 
    116117            Gtk::Menu*         menu,
    117118            SLV2PluginClass    plugin_class,
    118119            SLV2PluginClasses  classes,
    119             const LV2Children& children);
     120            const LV2Children& children,
     121            std::set<const char*>& ancestors);
    120122#endif
    121123
    122124    GraphObject::Properties get_initial_data();