[vlc-commits] [Git][videolan/vlc][master] qt: fix race condition when SystemPalette is destroyed
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Nov 21 11:19:35 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
fca56390 by Pierre Lamot at 2024-11-21T10:09:13+00:00
qt: fix race condition when SystemPalette is destroyed
As we don't control the destruction order of QML component, when scene is unloading
SystemPalette may be destroyed before ColorContext item that uses this palette, with
palette change not propagated in time.
- - - - -
1 changed file:
- modules/gui/qt/style/colorcontext.cpp
Changes:
=====================================
modules/gui/qt/style/colorcontext.cpp
=====================================
@@ -189,8 +189,7 @@ bool ColorContext::setInheritedPalette(SystemPalette* palette)
return false;
if (m_palette)
{
- disconnect(m_palette, &SystemPalette::sourceChanged, this, &ColorContext::colorsChanged);
- disconnect(m_palette, &SystemPalette::paletteChanged, this, &ColorContext::colorsChanged);
+ disconnect(m_palette, nullptr, this, nullptr);
}
m_palette = palette;
@@ -199,6 +198,17 @@ bool ColorContext::setInheritedPalette(SystemPalette* palette)
{
connect(m_palette, &SystemPalette::sourceChanged, this, &ColorContext::colorsChanged);
connect(m_palette, &SystemPalette::paletteChanged, this, &ColorContext::colorsChanged);
+ connect(m_palette, &SystemPalette::destroyed, this, [this](){
+ if (m_parentContext)
+ {
+ if (m_hasExplicitPalette)
+ connect(m_parentContext, &ColorContext::paletteChanged, this, &ColorContext::setInheritedPalette);
+ setInheritedPalette(m_parentContext->m_palette);
+ }
+ else
+ setInheritedPalette(nullptr);
+ m_hasExplicitPalette = false;
+ });
}
else
m_initialized = false;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fca563901ccfa05552412a85af7aad380d357775
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fca563901ccfa05552412a85af7aad380d357775
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