Crash when opening plugin manager after adding a plugin in the folder

• Nov 21, 2017 - 02:17
Reported version
2.2
Type
Functional
Severity
S2 - Critical
Status
closed
Project

How to reproduce:
1. Open MuseScore
2. Open the plugin manager dialog and close it.
3. Add a new plugin in the plugin folder
4. Go back to MuseScore and open the plugin manager.
5. Crash.

In Qt, we get the message :
ASSERT failure in QList::operator[]: "index out of range", file /home/steph/Qt/5.4/gcc_64/include/QtCore/qlist.h, line 486

The problem happens if we add a plugin in the folder, but not if we delete a plugin.


Comments

In reply to by Jojo-Schmitz

Yes, it's the same issue.

The problem comes from the way the toggled plugins are managed. As seen in the debug stack below, the crash happens in the QList, but the problem comes from the function PluginManager::pluginLoadToggled in pluginManager.cpp

The plugin list is initialized the first time we open the Plugin Manager. To keep track of which plugins are activited, it keeps the preferences using &prefs.pluginList[idx]; Unfortunately, that list isn't updated when new plugins are added to the plugin directory, so the index isn't valid anymore.

So from what I understand, MuseScore shouldn't base the checked state of the plugins on the index, but on the filename of the plugin. Maybe simply an array of all the names of the activated plugins?

Here's the debug stack (see number 5 and 6):

1 __GI_raise raise.c 54 0x7fffefc99428
2 __GI_abort abort.c 89 0x7fffefc9b02a
3 QMessageLogger::fatal(const char *, ...) const 0x7ffff0656ce6
4 qt_assert_x(const char *, const char *, const char *, int) 0x7ffff065192e
5 QList::operator[] qlist.h 486 0x108df0d
6 Ms::PluginManager::pluginLoadToggled pluginManager.cpp 162 0x109b866
7 Ms::PluginManager::qt_static_metacall moc_pluginManager.cpp 96 0x10b1797
8 QMetaObject::activate(QObject *, int, int, void * *) 0x7ffff08cface
9 QListWidget::itemChanged(QListWidgetItem *) 0x7ffff18eff92
10 QMetaObject::activate(QObject *, int, int, void * *) 0x7ffff08cface
11 QAbstractItemModel::dataChanged(QModelIndex const&, QModelIndex const&, QVector const&) 0x7ffff094ce5c
12 ?? 0x7ffff18f2615
13 QListWidgetItem::setData(int, QVariant const&) 0x7ffff18f32bb
14 Ms::PluginManager::loadList pluginManager.cpp 86 0x109b1c6
15 Ms::PluginManager::init pluginManager.cpp 52 0x109add1
16 Ms::MuseScore::showPluginManager musescore.cpp 3922 0xc035d9
17 Ms::MuseScore::cmd musescore.cpp 4594 0xc076bd
18 Ms::MuseScore::cmd musescore.cpp 4319 0xc05db4
19 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 726 0x10ace29
20 QMetaObject::activate(QObject *, int, int, void * *) 0x7ffff08cface
...