mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
change handling of life-time of TabletProxy QObjects
This commit is contained in:
parent
b7daf8c80b
commit
077a4fe4ae
2 changed files with 5 additions and 5 deletions
|
@ -49,13 +49,14 @@ QObject* TabletScriptingInterface::getTablet(const QString& tabletId) {
|
|||
auto iter = _tabletProxies.find(tabletId);
|
||||
if (iter != _tabletProxies.end()) {
|
||||
// tablet already exists, just return it.
|
||||
return iter->second.data();
|
||||
return iter->second;
|
||||
} else {
|
||||
// allocate a new tablet, add it to the map then return it.
|
||||
auto tabletProxy = QSharedPointer<TabletProxy>(new TabletProxy(tabletId));
|
||||
auto tabletProxy = new TabletProxy(tabletId);
|
||||
tabletProxy->setParent(this);
|
||||
_tabletProxies[tabletId] = tabletProxy;
|
||||
tabletProxy->setToolbarMode(_toolbarMode);
|
||||
return tabletProxy.data();
|
||||
return tabletProxy;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,6 @@ class TabletRootWindow : public QmlWindowClass {
|
|||
};
|
||||
|
||||
TabletProxy::TabletProxy(QString name) : _name(name) {
|
||||
|
||||
}
|
||||
|
||||
void TabletProxy::setToolbarMode(bool toolbarMode) {
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
|
||||
protected:
|
||||
std::mutex _mutex;
|
||||
std::map<QString, QSharedPointer<TabletProxy>> _tabletProxies;
|
||||
std::map<QString, TabletProxy*> _tabletProxies;
|
||||
QObject* _toolbarScriptingInterface { nullptr };
|
||||
bool _toolbarMode { false };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue