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
2121 #include <InfoView.h>
2222 #include "SoundEffect.h"
2323
24+
25+QScriptValue 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+
30+void tabletFromScriptValue(const QScriptValue& value, TabletProxy* &out) {
31+ qDebug() << "----------------> value to tabletProxy <----------------";
32+ out = qobject_cast<TabletProxy*>(value.toQObject());
33+}
34+
2435 TabletScriptingInterface::TabletScriptingInterface() {
2536 qmlRegisterType<SoundEffect>("Hifi", 1, 0, "SoundEffect");
2637 }
@@ -41,7 +52,7 @@ QObject* TabletScriptingInterface::getSystemToolbarProxy() { · 14 unmodified lines
4152 }
4253 }
4354
44−QObject* TabletScriptingInterface::getTablet(const QString& tabletId) {
55+TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) {
4556
4657 std::lock_guard<std::mutex> guard(_mutex);
4758
@@ -81,11 +92,6 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm · 33 unmodified lines
8192
8293 QQuickWindow* TabletScriptingInterface::getTabletWindow() {
8394 TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system"));
84−
85− if (!tablet) {
86− return nullptr;
87− }
88−
8995 QObject* qmlSurface = tablet->getTabletSurface();
9096 OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface);
9197