Commit 744ff9bb authored by Àlex Fiestas's avatar Àlex Fiestas
Browse files

Set a new Object as parent of BlueZAgent

You can't register a child of a parent exposed with ExportChildObjects, if
you do so the app may crash.

for not making this patch too big I'm using the parent() reference from
the BlueAgent object itself to delete the parent and this will delete
the agent.  I will improve it in BlueDevil 2.0

Versions minor to 1.3 are not affected by this bug since they use qApp
as a parent instead of BlueDevilDAemon.

BUG: 284052
parent d1eb83b2
......@@ -179,7 +179,7 @@ void BlueDevilDaemon::onlineMode()
return;
}
d->m_bluezAgent = new BluezAgent(this);
d->m_bluezAgent = new BluezAgent(new QObject());
connect(d->m_bluezAgent, SIGNAL(agentReleased()), this, SLOT(agentReleased()));
d->m_adapter = Manager::self()->defaultAdapter();
......@@ -224,7 +224,7 @@ void BlueDevilDaemon::offlineMode()
d->m_adapter = 0;
if (d->m_bluezAgent) {
delete d->m_bluezAgent;
delete d->m_bluezAgent->parent(); // we meed to delete the parent for not leaking it
d->m_bluezAgent = 0;
}
......
......@@ -54,7 +54,7 @@ void BluezAgent::unregister()
defaultAdapter->unregisterAgent(AGENT_PATH);
}
QDBusConnection::systemBus().unregisterObject(AGENT_PATH);
deleteLater();
parent()->deleteLater();
}
void BluezAgent::Release()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment