summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-12-07 19:07:54 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-12-07 19:07:54 +0800
commit0692b82f83fd0c8fb0191c77c2b9bb5a5ed90068 (patch)
tree4e9b381d4c099fdce0ff1533cabc1d4da10e077e
parent89309f4ab37cb5eb05f3b7123a93d484710f752b (diff)
downloadcompiz-with-glib-mainloop-0692b82f83fd0c8fb0191c77c2b9bb5a5ed90068.tar.gz
compiz-with-glib-mainloop-0692b82f83fd0c8fb0191c77c2b9bb5a5ed90068.tar.bz2
Fix assertion if core is specified as plugin on the command line.
Forward port 2a0087732f23cd87284366ec0dc224cbd5fd68ec to master
-rw-r--r--src/screen.cpp35
1 files changed, 21 insertions, 14 deletions
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 ())
{