From 0692b82f83fd0c8fb0191c77c2b9bb5a5ed90068 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Tue, 7 Dec 2010 19:07:54 +0800 Subject: Fix assertion if core is specified as plugin on the command line. Forward port 2a0087732f23cd87284366ec0dc224cbd5fd68ec to master --- src/screen.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/screen.cpp b/src/screen.cpp index af2bf5f..80cf93b 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -792,7 +792,7 @@ void PrivateScreen::updatePlugins () { CompPlugin *p; - unsigned int nPop, i, j, dupPluginCount; + unsigned int nPop, i, j, pListCount = 1; CompOption::Value::Vector pList; CompPlugin::List pop; bool failedPush; @@ -802,31 +802,38 @@ PrivateScreen::updatePlugins () CompOption::Value::Vector &list = optionGetActivePlugins (); - /* Make sure the new plugin list always has core first, then the - * initial plugins.... */ - - dupPluginCount = 0; + /* Determine the number of plugins, which is core + + * initial plugins + plugins in option list in addition + * to initial plugins */ + foreach (CompString &pn, initialPlugins) + { + if (pn != "core") + pListCount++; + } foreach (CompOption::Value &lp, list) { + bool skip = false; if (lp.s () == "core") - dupPluginCount++; - else + continue; + + foreach (CompString &p, initialPlugins) { - foreach (CompString &p, initialPlugins) + if (p == lp.s ()) { - if (p == lp.s ()) - { - dupPluginCount++; - break; - } + skip = true; + break; } } + + /* plugin not in initial list */ + if (!skip) + pListCount++; } /* dupPluginCount is now the number of plugisn contained in both the * initial and new plugins list */ - pList.resize (1 + initialPlugins.size () + list.size () - dupPluginCount); + pList.resize (pListCount); if (pList.empty ()) { -- cgit v1.1