mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 06:44:07 +02:00
delete websurfaces on shutdown
This commit is contained in:
parent
55a4210053
commit
be23668ca8
3 changed files with 11 additions and 2 deletions
|
@ -229,7 +229,7 @@ public:
|
||||||
|
|
||||||
qint64 getCurrentSessionRuntime() const { return _sessionRunTimer.elapsed(); }
|
qint64 getCurrentSessionRuntime() const { return _sessionRunTimer.elapsed(); }
|
||||||
|
|
||||||
bool isAboutToQuit() const { return _aboutToQuit; }
|
bool isAboutToQuit() const override { return _aboutToQuit; }
|
||||||
bool isPhysicsEnabled() const { return _physicsEnabled; }
|
bool isPhysicsEnabled() const { return _physicsEnabled; }
|
||||||
|
|
||||||
// the isHMDMode is true whenever we use the interface from an HMD and not a standard flat display
|
// the isHMDMode is true whenever we use the interface from an HMD and not a standard flat display
|
||||||
|
|
|
@ -95,7 +95,13 @@ bool RenderableWebEntityItem::buildWebSurface(EntityTreeRenderer* renderer) {
|
||||||
|
|
||||||
auto deleter = [](OffscreenQmlSurface* webSurface) {
|
auto deleter = [](OffscreenQmlSurface* webSurface) {
|
||||||
AbstractViewStateInterface::instance()->postLambdaEvent([webSurface] {
|
AbstractViewStateInterface::instance()->postLambdaEvent([webSurface] {
|
||||||
webSurface->deleteLater();
|
if (AbstractViewStateInterface::instance()->isAboutToQuit()) {
|
||||||
|
// WebEngineView may run other threads (wasapi), so they must be deleted for a clean shutdown
|
||||||
|
// if the application has already stopped its event loop, delete must be explicit
|
||||||
|
delete webSurface;
|
||||||
|
} else {
|
||||||
|
webSurface->deleteLater();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
_webSurface = QSharedPointer<OffscreenQmlSurface>(new OffscreenQmlSurface(), deleter);
|
_webSurface = QSharedPointer<OffscreenQmlSurface>(new OffscreenQmlSurface(), deleter);
|
||||||
|
@ -331,6 +337,7 @@ void RenderableWebEntityItem::destroyWebSurface() {
|
||||||
if (rootItem) {
|
if (rootItem) {
|
||||||
QObject* obj = rootItem->findChild<QObject*>("webEngineView");
|
QObject* obj = rootItem->findChild<QObject*>("webEngineView");
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
// stop loading
|
||||||
QMetaObject::invokeMethod(obj, "stop");
|
QMetaObject::invokeMethod(obj, "stop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,9 @@ public:
|
||||||
|
|
||||||
virtual glm::vec3 getAvatarPosition() const = 0;
|
virtual glm::vec3 getAvatarPosition() const = 0;
|
||||||
|
|
||||||
|
virtual bool isAboutToQuit() const = 0;
|
||||||
virtual void postLambdaEvent(std::function<void()> f) = 0;
|
virtual void postLambdaEvent(std::function<void()> f) = 0;
|
||||||
|
|
||||||
virtual qreal getDevicePixelRatio() = 0;
|
virtual qreal getDevicePixelRatio() = 0;
|
||||||
|
|
||||||
virtual render::ScenePointer getMain3DScene() = 0;
|
virtual render::ScenePointer getMain3DScene() = 0;
|
||||||
|
|
Loading…
Reference in a new issue