History

change handling of life-time of TabletProxy QObjects

Seth Alves committed 9 years ago

Commit 077a4fe1 parent b7daf8c2 files · +5 −5Browse files

Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

libraries/script-engine/src/TabletScriptingInterface.cpp+4−4
@@ -49,13 +49,14 @@ QObject* TabletScriptingInterface::getTablet(const QString& tabletId) { · 48 unmodified lines
49 auto iter = _tabletProxies.find(tabletId);49 auto iter = _tabletProxies.find(tabletId);
50 if (iter != _tabletProxies.end()) {50 if (iter != _tabletProxies.end()) {
51 // tablet already exists, just return it.51 // tablet already exists, just return it.
52 return iter->second.data();52 return iter->second;
53 } else {53 } else {
54 // allocate a new tablet, add it to the map then return it.54 // allocate a new tablet, add it to the map then return it.
55 auto tabletProxy = QSharedPointer<TabletProxy>(new TabletProxy(tabletId));55 auto tabletProxy = new TabletProxy(tabletId);
56 tabletProxy->setParent(this);
56 _tabletProxies[tabletId] = tabletProxy;57 _tabletProxies[tabletId] = tabletProxy;
57 tabletProxy->setToolbarMode(_toolbarMode);58 tabletProxy->setToolbarMode(_toolbarMode);
58 return tabletProxy.data();59 return tabletProxy;
59 }60 }
60}61}
61 62
@@ -176,7 +177,6 @@ class TabletRootWindow : public QmlWindowClass { · 114 unmodified lines
176};177};
177 178
178TabletProxy::TabletProxy(QString name) : _name(name) {179TabletProxy::TabletProxy(QString name) : _name(name) {
179
180}180}
181 181
182void TabletProxy::setToolbarMode(bool toolbarMode) {182void TabletProxy::setToolbarMode(bool toolbarMode) {