[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix undefined behavior when openvg scene graph backend is used
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Sep 2 14:36:17 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a8cd2d21 by Fatih Uzunoglu at 2024-09-02T13:19:54+00:00
qt: fix undefined behavior when openvg scene graph backend is used
When OpenVG is used, the rectangle node provided does not offer
a material. At the same time, it is also not a null pointer but
it explicitly points to memory address "1" as a workaround done
by Qt.
Obviously, that memory address does not contain a real `QSGMaterial`
instance, so dereferencing the material causes segmentation fault.
- - - - -
4447ccb6 by Fatih Uzunoglu at 2024-09-02T13:19:54+00:00
qt: disable pip and backdrop effect when scene graph backend is openvg
- - - - -
2 changed files:
- modules/gui/qt/maininterface/compositor.cpp
- modules/gui/qt/widgets/native/viewblockingrectangle.cpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor.cpp
=====================================
@@ -265,11 +265,12 @@ bool CompositorVideo::commonGUICreateImpl(QWindow* window, CompositorVideo::Flag
m_videoSurfaceProvider = std::make_unique<VideoSurfaceProvider>();
m_mainCtx->setVideoSurfaceProvider(m_videoSurfaceProvider.get());
- if (flags & CompositorVideo::CAN_SHOW_PIP)
+ const bool backendIsOpenVg = QQuickWindow::sceneGraphBackend() == QLatin1String("openvg");
+ if (!backendIsOpenVg && (flags & CompositorVideo::CAN_SHOW_PIP))
{
m_mainCtx->setCanShowVideoPIP(true);
}
- if (flags & CompositorVideo::HAS_ACRYLIC)
+ if (!backendIsOpenVg && (flags & CompositorVideo::HAS_ACRYLIC))
{
setBlurBehind(window, true);
}
=====================================
modules/gui/qt/widgets/native/viewblockingrectangle.cpp
=====================================
@@ -95,7 +95,14 @@ ViewBlockingRectangle::ViewBlockingRectangle(QQuickItem *parent)
{
setFlag(QQuickItem::ItemHasContents);
connect(this, &ViewBlockingRectangle::colorChanged, this, &QQuickItem::update);
- connect(this, &ViewBlockingRectangle::windowChanged, this, [this] { m_windowChanged = true; });
+ connect(this, &ViewBlockingRectangle::windowChanged, this, [this] {
+ if (window())
+ {
+ // The new window might use an appropriate graphics API:
+ setFlag(QQuickItem::ItemHasContents);
+ m_windowChanged = true;
+ }
+ });
}
QSGNode *ViewBlockingRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
@@ -124,7 +131,18 @@ QSGNode *ViewBlockingRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNod
{
rectangleNode = window()->createRectangleNode();
assert(rectangleNode);
- assert(rectangleNode->material());
+
+ const auto material = rectangleNode->material();
+ if (!material ||
+ material == reinterpret_cast<QSGMaterial*>(1) /* Qt may explicitly set the material pointer to 1 in OpenVG */)
+ {
+ // Scene graph adaptation does not support shading
+ qmlDebug(this) << "ViewBlockingRectangle is being used under an incompatible scene graph adaptation.";
+ delete rectangleNode;
+ setFlag(QQuickItem::ItemHasContents, false);
+ return nullptr;
+ }
+
rectangleNode->material()->setFlag(QSGMaterial::Blending, false);
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0361de5cbea327c84591dffeae8e597f3f8c98c5...4447ccb63c826a9af5bdcc9f60841c1c881fc02d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0361de5cbea327c84591dffeae8e597f3f8c98c5...4447ccb63c826a9af5bdcc9f60841c1c881fc02d
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list