Merge lp:~michael-sheldon/ubuntu-keyboard/fix-wordengine-leak into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 307
Merged at revision: 315
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-wordengine-leak
Merge into: lp:ubuntu-keyboard
Diff against target: 95 lines (+16/-11)
5 files modified
plugins/pinyin/src/pinyinadapter.cpp (+0/-1)
plugins/pinyin/src/pinyinplugin.cpp (+1/-0)
plugins/westernsupport/westernlanguagesplugin.cpp (+12/-10)
plugins/westernsupport/westernlanguagesplugin.h (+2/-0)
src/lib/logic/wordengine.cpp (+1/-0)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-wordengine-leak
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+249482@code.launchpad.net

Commit message

Fix memory leak when unloading word engines

Description of the change

Fix memory leak when unloading word engines

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-keyboard) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * No change

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/pinyin/src/pinyinadapter.cpp'
2--- plugins/pinyin/src/pinyinadapter.cpp 2015-01-05 09:41:19 +0000
3+++ plugins/pinyin/src/pinyinadapter.cpp 2015-02-12 12:25:21 +0000
4@@ -35,7 +35,6 @@
5
6 PinyinAdapter::~PinyinAdapter()
7 {
8- g_array_free(m_array, TRUE);
9 pinyin_free_instance(m_instance);
10 pinyin_fini(m_context);
11 }
12
13=== modified file 'plugins/pinyin/src/pinyinplugin.cpp'
14--- plugins/pinyin/src/pinyinplugin.cpp 2014-08-01 15:40:48 +0000
15+++ plugins/pinyin/src/pinyinplugin.cpp 2015-02-12 12:25:21 +0000
16@@ -12,6 +12,7 @@
17
18 PinyinPlugin::~PinyinPlugin()
19 {
20+ delete pinyinAdapter;
21 }
22
23 void PinyinPlugin::predict(const QString& surroundingLeft, const QString& preedit)
24
25=== modified file 'plugins/westernsupport/westernlanguagesplugin.cpp'
26--- plugins/westernsupport/westernlanguagesplugin.cpp 2015-02-02 15:09:28 +0000
27+++ plugins/westernsupport/westernlanguagesplugin.cpp 2015-02-12 12:25:21 +0000
28@@ -10,23 +10,25 @@
29 , m_spellCheckEnabled(false)
30 {
31 m_spellPredictThread = new QThread();
32- SpellPredictWorker *spellPredictWorker = new SpellPredictWorker();
33- spellPredictWorker->moveToThread(m_spellPredictThread);
34+ m_spellPredictWorker = new SpellPredictWorker();
35+ m_spellPredictWorker->moveToThread(m_spellPredictThread);
36
37- connect(spellPredictWorker, SIGNAL(newSpellingSuggestions(QString, QStringList)), this, SIGNAL(newSpellingSuggestions(QString, QStringList)));
38- connect(spellPredictWorker, SIGNAL(newPredictionSuggestions(QString, QStringList)), this, SIGNAL(newPredictionSuggestions(QString, QStringList)));
39- connect(this, SIGNAL(newSpellCheckWord(QString)), spellPredictWorker, SLOT(newSpellCheckWord(QString)));
40- connect(this, SIGNAL(setSpellPredictLanguage(QString)), spellPredictWorker, SLOT(setLanguage(QString)));
41- connect(this, SIGNAL(setSpellCheckLimit(int)), spellPredictWorker, SLOT(setSpellCheckLimit(int)));
42- connect(this, SIGNAL(parsePredictionText(QString, QString)), spellPredictWorker, SLOT(parsePredictionText(QString, QString)));
43- connect(this, SIGNAL(addToUserWordList(QString)), spellPredictWorker, SLOT(addToUserWordList(QString)));
44- connect(this, SIGNAL(addOverride(QString, QString)), spellPredictWorker, SLOT(addOverride(QString, QString)));
45+ connect(m_spellPredictWorker, SIGNAL(newSpellingSuggestions(QString, QStringList)), this, SIGNAL(newSpellingSuggestions(QString, QStringList)));
46+ connect(m_spellPredictWorker, SIGNAL(newPredictionSuggestions(QString, QStringList)), this, SIGNAL(newPredictionSuggestions(QString, QStringList)));
47+ connect(this, SIGNAL(newSpellCheckWord(QString)), m_spellPredictWorker, SLOT(newSpellCheckWord(QString)));
48+ connect(this, SIGNAL(setSpellPredictLanguage(QString)), m_spellPredictWorker, SLOT(setLanguage(QString)));
49+ connect(this, SIGNAL(setSpellCheckLimit(int)), m_spellPredictWorker, SLOT(setSpellCheckLimit(int)));
50+ connect(this, SIGNAL(parsePredictionText(QString, QString)), m_spellPredictWorker, SLOT(parsePredictionText(QString, QString)));
51+ connect(this, SIGNAL(addToUserWordList(QString)), m_spellPredictWorker, SLOT(addToUserWordList(QString)));
52+ connect(this, SIGNAL(addOverride(QString, QString)), m_spellPredictWorker, SLOT(addOverride(QString, QString)));
53 m_spellPredictThread->start();
54 }
55
56 WesternLanguagesPlugin::~WesternLanguagesPlugin()
57 {
58+ m_spellPredictWorker->deleteLater();
59 m_spellPredictThread->quit();
60+ m_spellPredictThread->wait();
61 }
62
63 void WesternLanguagesPlugin::predict(const QString& surroundingLeft, const QString& preedit)
64
65=== modified file 'plugins/westernsupport/westernlanguagesplugin.h'
66--- plugins/westernsupport/westernlanguagesplugin.h 2015-02-02 15:09:28 +0000
67+++ plugins/westernsupport/westernlanguagesplugin.h 2015-02-12 12:25:21 +0000
68@@ -6,6 +6,7 @@
69 #include "westernlanguagefeatures.h"
70 #include "spellchecker.h"
71 #include "abstractlanguageplugin.h"
72+#include "spellpredictworker.h"
73
74 #include <presage.h>
75
76@@ -49,6 +50,7 @@
77
78 private:
79 WesternLanguageFeatures* m_languageFeatures;
80+ SpellPredictWorker *m_spellPredictWorker;
81 QThread *m_spellPredictThread;
82 bool m_spellCheckEnabled;
83 };
84
85=== modified file 'src/lib/logic/wordengine.cpp'
86--- src/lib/logic/wordengine.cpp 2015-02-09 21:13:37 +0000
87+++ src/lib/logic/wordengine.cpp 2015-02-12 12:25:21 +0000
88@@ -76,6 +76,7 @@
89 if (pluginName == currentPlugin)
90 return;
91
92+ delete languagePlugin;
93 pluginLoader.unload();
94
95 // to avoid hickups in libpresage, libpinyin

Subscribers

People subscribed via source and target branches