Skip to content

Commit

Permalink
Initialise MythCoreContextPrivate::pluginmanager to NULL and add guar…
Browse files Browse the repository at this point in the history
…ds against leaks if SetPluginManager() is called twice
  • Loading branch information
stuartm committed May 23, 2013
1 parent 50c7efa commit bc02402
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mythtv/libs/libmythbase/mythcorecontext.cpp
Expand Up @@ -110,7 +110,8 @@ MythCoreContextPrivate::MythCoreContextPrivate(MythCoreContext *lparent,
m_UIThread(QThread::currentThread()),
m_locale(NULL),
m_scheduler(NULL),
m_blockingClient(false)
m_blockingClient(false),
pluginmanager(NULL)
{
MThread::ThreadSetup("CoreContext");
srandom(MythDate::current().toTime_t() ^ QTime::currentTime().msec());
Expand Down Expand Up @@ -1469,6 +1470,15 @@ bool MythCoreContext::TestPluginVersion(const QString &name,

void MythCoreContext::SetPluginManager(MythPluginManager *pmanager)
{
if (d->pluginmanager == pmanager)
return;

if (d->pluginmanager)
{
delete d->pluginmanager;
d->pluginmanager = NULL;
}

d->pluginmanager = pmanager;
}

Expand Down

0 comments on commit bc02402

Please sign in to comment.