Skip to content

Commit

Permalink
Merge pull request #116 from mitya57/fix-segfault
Browse files Browse the repository at this point in the history
Prevent QList returned by subject->pluginDescriptions from being deleted
  • Loading branch information
dobey authored Sep 19, 2022
2 parents 7a929ce + 581adc2 commit 19a763c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/ft_mimpluginmanager/ft_mimpluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,19 @@ void Ft_MIMPluginManager::testPluginDescriptions()

MImSettings enabledPluginsSettings(EnabledPluginsKey);
QStringList enabledPlugins;

QList<MImPluginDescription> pluginDescriptions;
const MImPluginDescription *description = 0;

enabledPlugins << pluginId + ":" + "dummyimsv1";
enabledPluginsSettings.set(enabledPlugins);
QCOMPARE(spy.count(), 1);

description = findPluginDescriptions(subject->pluginDescriptions(Maliit::OnScreen), pluginName);
pluginDescriptions = subject->pluginDescriptions(Maliit::OnScreen);
description = findPluginDescriptions(pluginDescriptions, pluginName);
QVERIFY(description);
QVERIFY(description->enabled());
description = findPluginDescriptions(subject->pluginDescriptions(Maliit::OnScreen), pluginName3);
description = findPluginDescriptions(pluginDescriptions, pluginName3);
QVERIFY(description);
QVERIFY(!description->enabled());
description = 0;
Expand All @@ -220,10 +223,11 @@ void Ft_MIMPluginManager::testPluginDescriptions()
enabledPluginsSettings.set(enabledPlugins);
QCOMPARE(spy.count(), 2);

description = findPluginDescriptions(subject->pluginDescriptions(Maliit::OnScreen), pluginName);
pluginDescriptions = subject->pluginDescriptions(Maliit::OnScreen);
description = findPluginDescriptions(pluginDescriptions, pluginName);
QVERIFY(description);
QVERIFY(description->enabled());
description = findPluginDescriptions(subject->pluginDescriptions(Maliit::OnScreen), pluginName3);
description = findPluginDescriptions(pluginDescriptions, pluginName3);
QVERIFY(description);
QVERIFY(!description->enabled());
description = 0;
Expand All @@ -232,10 +236,11 @@ void Ft_MIMPluginManager::testPluginDescriptions()
enabledPluginsSettings.set(enabledPlugins);
QCOMPARE(spy.count(), 3);

description = findPluginDescriptions(subject->pluginDescriptions(Maliit::OnScreen), pluginName);
pluginDescriptions = subject->pluginDescriptions(Maliit::OnScreen);
description = findPluginDescriptions(pluginDescriptions, pluginName);
QVERIFY(description);
QVERIFY(description->enabled());
description = findPluginDescriptions(subject->pluginDescriptions(Maliit::OnScreen), pluginName3);
description = findPluginDescriptions(pluginDescriptions, pluginName3);
QVERIFY(description);
QVERIFY(description->enabled());
description = 0;
Expand Down

0 comments on commit 19a763c

Please sign in to comment.