Registry::Registry()
: iRegistry()
{
- setObjectName(QString("%1-iRegistry").arg(VER_MODULENAME_STR));
+ setObjectName(QString("%1-iRegistry").arg(VER_MODULE_NAME_STR));
// Register our own interface
registerInterface("iRegistry", this);
bool Registry::registerInterface(QString const & name, QObject * obj)
{
- mInterfaces.insert(name, QPointer<QObject>(obj));
+ mInterfaces.insert(name, QWeakPointer<QObject>(obj));
+
+ return true;
}
-QObject * Registry::queryInterface(QString const & name)
+QObject * Registry::queryInterface(QString const & name) const
{
- QHash<QString, QPointer<QObject> >::const_iterator it = mInterfaces.constFind(name);
- return it != mInterfaces.constEnd() ? *it : 0;
+ QHash<QString, QWeakPointer<QObject> >::const_iterator it = mInterfaces.constFind(name);
+ return it != mInterfaces.constEnd() ? (*it).data() : 0;
}