History

crash fix

Dante Ruiz committed 9 years ago

Commit 1ec40811 parent b2a11aa3 files · +22 −8Browse files

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

Unified · Split

libraries/script-engine/src/TabletScriptingInterface.cpp+12−6
@@ -21,6 +21,17 @@ · 20 unmodified lines
21#include <InfoView.h>21#include <InfoView.h>
22#include "SoundEffect.h"22#include "SoundEffect.h"
23 23
24
25QScriptValue tabletToScriptValue(QScriptEngine* engine, TabletProxy* const &in) {
26 qDebug() << "------------------- converting tabletProxy to scriptValue <--------------------";
27 return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater | QScriptEngine::ExcludeChildObjects);
28}
29
30void tabletFromScriptValue(const QScriptValue& value, TabletProxy* &out) {
31 qDebug() << "----------------> value to tabletProxy <----------------";
32 out = qobject_cast<TabletProxy*>(value.toQObject());
33}
34
24TabletScriptingInterface::TabletScriptingInterface() {35TabletScriptingInterface::TabletScriptingInterface() {
25 qmlRegisterType<SoundEffect>("Hifi", 1, 0, "SoundEffect");36 qmlRegisterType<SoundEffect>("Hifi", 1, 0, "SoundEffect");
26}37}
@@ -41,7 +52,7 @@ QObject* TabletScriptingInterface::getSystemToolbarProxy() { · 14 unmodified lines
41 }52 }
42}53}
43 54
44QObject* TabletScriptingInterface::getTablet(const QString& tabletId) {55TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) {
45 56
46 std::lock_guard<std::mutex> guard(_mutex);57 std::lock_guard<std::mutex> guard(_mutex);
47 58
@@ -81,11 +92,6 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm · 33 unmodified lines
81 92
82QQuickWindow* TabletScriptingInterface::getTabletWindow() {93QQuickWindow* TabletScriptingInterface::getTabletWindow() {
83 TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system"));94 TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system"));
84
85 if (!tablet) {
86 return nullptr;
87 }
88
89 QObject* qmlSurface = tablet->getTabletSurface();95 QObject* qmlSurface = tablet->getTabletSurface();
90 OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface);96 OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface);
91 97