From 9c97724fc96792a544f4efd1593eaf6e966d3645 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 7 Mar 2020 02:23:56 +0100 Subject: [PATCH] Fix OSC endless loop for tracks with hidden plugins --- libs/surfaces/osc/osc.cc | 41 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 4daf6dd6f9..e7dce2cca2 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -3083,32 +3083,25 @@ OSC::_sel_plugin (int id, lo_address addr) return 1; } - // find out how many plugins we have - bool plugs; - int nplugs = 0; + /* find out how many plugins we have */ sur->plugins.clear(); - do { - plugs = false; - if (r->nth_plugin (nplugs)) { - if (r->nth_plugin(nplugs)->display_to_user()) { -#ifdef MIXBUS - // need to check for mixbus channel strips (and exclude them) - boost::shared_ptr proc = r->nth_plugin (nplugs); - boost::shared_ptr pi; - if ((pi = boost::dynamic_pointer_cast(proc))) { - - if (!pi->is_channelstrip()) { -#endif - sur->plugins.push_back (nplugs); - nplugs++; -#ifdef MIXBUS - } - } -#endif - } - plugs = true; + for (int nplugs = 0; true; ++nplugs) { + boost::shared_ptr proc = r->nth_plugin (nplugs); + if (!proc) { + break; } - } while (plugs); + if (!r->nth_plugin(nplugs)->display_to_user()) { + continue; + } +#ifdef MIXBUS + /* need to check for mixbus channel strips (and exclude them) */ + boost::shared_ptr pi = boost::dynamic_pointer_cast(proc); + if (pi && pi->is_channelstrip()) { + continue; + } +#endif + sur->plugins.push_back (nplugs); + } // limit plugin_id to actual plugins if (sur->plugins.size() < 1) {