mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 12:04:03 +02:00
Merge pull request #14426 from ElderOrb/FB19400
FB19400 during shutdown -- TypeError: Cannot read property 'buttons' of null
This commit is contained in:
commit
43f84a9577
5 changed files with 26 additions and 5 deletions
|
@ -70,8 +70,8 @@ OriginalDesktop.Desktop {
|
||||||
anchors.horizontalCenter: settings.constrainToolbarToCenterX ? desktop.horizontalCenter : undefined;
|
anchors.horizontalCenter: settings.constrainToolbarToCenterX ? desktop.horizontalCenter : undefined;
|
||||||
// Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained.
|
// Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained.
|
||||||
x: sysToolbar.x
|
x: sysToolbar.x
|
||||||
buttonModel: tablet.buttons;
|
buttonModel: tablet ? tablet.buttons : null;
|
||||||
shown: tablet.toolbarMode;
|
shown: tablet ? tablet.toolbarMode : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
|
|
|
@ -115,9 +115,9 @@ Item {
|
||||||
property int previousIndex: -1
|
property int previousIndex: -1
|
||||||
Repeater {
|
Repeater {
|
||||||
id: pageRepeater
|
id: pageRepeater
|
||||||
model: Math.ceil(tabletProxy.buttons.rowCount() / TabletEnums.ButtonsOnPage)
|
model: tabletProxy != null ? Math.ceil(tabletProxy.buttons.rowCount() / TabletEnums.ButtonsOnPage) : 0
|
||||||
onItemAdded: {
|
onItemAdded: {
|
||||||
item.proxyModel.sourceModel = tabletProxy.buttons;
|
item.proxyModel.sourceModel = tabletProxy != null ? tabletProxy.buttons : null;
|
||||||
item.proxyModel.pageIndex = index;
|
item.proxyModel.pageIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -389,6 +389,10 @@ void OffscreenSurface::finishQmlLoad(QQmlComponent* qmlComponent,
|
||||||
}
|
}
|
||||||
// Allow child windows to be destroyed from JS
|
// Allow child windows to be destroyed from JS
|
||||||
QQmlEngine::setObjectOwnership(newObject, QQmlEngine::JavaScriptOwnership);
|
QQmlEngine::setObjectOwnership(newObject, QQmlEngine::JavaScriptOwnership);
|
||||||
|
|
||||||
|
// add object to the manual deletion list
|
||||||
|
_sharedObject->addToDeletionList(newObject);
|
||||||
|
|
||||||
newObject->setParent(parent);
|
newObject->setParent(parent);
|
||||||
newItem->setParentItem(parent);
|
newItem->setParentItem(parent);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <QtQml/QQmlEngine>
|
#include <QtQml/QQmlEngine>
|
||||||
|
|
||||||
#include <QtGui/QOpenGLContext>
|
#include <QtGui/QOpenGLContext>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
#include <shared/NsightHelpers.h>
|
#include <shared/NsightHelpers.h>
|
||||||
|
@ -96,6 +97,15 @@ SharedObject::~SharedObject() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// already deleted objects will be reset to null by QPointer so it should be safe just iterate here
|
||||||
|
for (auto qmlObject : _deletionList) {
|
||||||
|
if (qmlObject) {
|
||||||
|
// manually delete not-deleted-yet qml items
|
||||||
|
QQmlEngine::setObjectOwnership(qmlObject, QQmlEngine::CppOwnership);
|
||||||
|
delete qmlObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_rootItem) {
|
if (_rootItem) {
|
||||||
delete _rootItem;
|
delete _rootItem;
|
||||||
_rootItem = nullptr;
|
_rootItem = nullptr;
|
||||||
|
@ -412,6 +422,11 @@ bool SharedObject::fetchTexture(TextureAndFence& textureAndFence) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hifi::qml::impl::SharedObject::addToDeletionList(QObject * object)
|
||||||
|
{
|
||||||
|
_deletionList.append(QPointer<QObject>(object));
|
||||||
|
}
|
||||||
|
|
||||||
void SharedObject::setProxyWindow(QWindow* window) {
|
void SharedObject::setProxyWindow(QWindow* window) {
|
||||||
#ifndef DISABLE_QML
|
#ifndef DISABLE_QML
|
||||||
_proxyWindow = window;
|
_proxyWindow = window;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
void resume();
|
void resume();
|
||||||
bool isPaused() const;
|
bool isPaused() const;
|
||||||
bool fetchTexture(TextureAndFence& textureAndFence);
|
bool fetchTexture(TextureAndFence& textureAndFence);
|
||||||
|
void addToDeletionList(QObject* object);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool event(QEvent* e) override;
|
bool event(QEvent* e) override;
|
||||||
|
@ -91,6 +91,8 @@ private:
|
||||||
void onAboutToQuit();
|
void onAboutToQuit();
|
||||||
void updateTextureAndFence(const TextureAndFence& newTextureAndFence);
|
void updateTextureAndFence(const TextureAndFence& newTextureAndFence);
|
||||||
|
|
||||||
|
QList<QPointer<QObject>> _deletionList;
|
||||||
|
|
||||||
// Texture management
|
// Texture management
|
||||||
TextureAndFence _latestTextureAndFence{ 0, 0 };
|
TextureAndFence _latestTextureAndFence{ 0, 0 };
|
||||||
QQuickItem* _item{ nullptr };
|
QQuickItem* _item{ nullptr };
|
||||||
|
|
Loading…
Reference in a new issue