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
4949 auto iter = _tabletProxies.find(tabletId);
5050 if (iter != _tabletProxies.end()) {
5151 // tablet already exists, just return it.
52− return iter->second.data();
52+ return iter->second;
5353 } else {
5454 // 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);
5657 _tabletProxies[tabletId] = tabletProxy;
5758 tabletProxy->setToolbarMode(_toolbarMode);
58− return tabletProxy.data();
59+ return tabletProxy;
5960 }
6061 }
6162
@@ -176,7 +177,6 @@ class TabletRootWindow : public QmlWindowClass { · 114 unmodified lines
176177 };
177178
178179 TabletProxy::TabletProxy(QString name) : _name(name) {
179−
180180 }
181181
182182 void TabletProxy::setToolbarMode(bool toolbarMode) {