mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #8951 from zzmp/fix/crash-on-web-wasapi
fix crash on shutdown from web audio captures
This commit is contained in:
commit
d9d9119dcb
4 changed files with 12 additions and 2 deletions
|
@ -229,7 +229,7 @@ public:
|
|||
|
||||
qint64 getCurrentSessionRuntime() const { return _sessionRunTimer.elapsed(); }
|
||||
|
||||
bool isAboutToQuit() const { return _aboutToQuit; }
|
||||
bool isAboutToQuit() const override { return _aboutToQuit; }
|
||||
bool isPhysicsEnabled() const { return _physicsEnabled; }
|
||||
|
||||
// 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) {
|
||||
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);
|
||||
|
@ -331,6 +337,7 @@ void RenderableWebEntityItem::destroyWebSurface() {
|
|||
if (rootItem) {
|
||||
QObject* obj = rootItem->findChild<QObject*>("webEngineView");
|
||||
if (obj) {
|
||||
// stop loading
|
||||
QMetaObject::invokeMethod(obj, "stop");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,9 @@ public:
|
|||
|
||||
virtual glm::vec3 getAvatarPosition() const = 0;
|
||||
|
||||
virtual bool isAboutToQuit() const = 0;
|
||||
virtual void postLambdaEvent(std::function<void()> f) = 0;
|
||||
|
||||
virtual qreal getDevicePixelRatio() = 0;
|
||||
|
||||
virtual render::ScenePointer getMain3DScene() = 0;
|
||||
|
|
|
@ -425,6 +425,7 @@ protected:
|
|||
return vec3();
|
||||
}
|
||||
|
||||
bool isAboutToQuit() const override { return false; }
|
||||
void postLambdaEvent(std::function<void()> f) override {}
|
||||
|
||||
qreal getDevicePixelRatio() override {
|
||||
|
|
Loading…
Reference in a new issue