[vlc-commits] [Git][videolan/vlc][master] qt: check whether attached tool tip instance adjustment succeeded asynchronously
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Jun 24 03:32:26 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e1d73e29 by Fatih Uzunoglu at 2026-06-24T03:18:51+00:00
qt: check whether attached tool tip instance adjustment succeeded asynchronously
In some cases `NDEBUG` might not be defined in release builds, in order to enable
assertions. We should still be careful about doing things that can take some
time even when `NDEBUG` is not defined.
- - - - -
1 changed file:
- modules/gui/qt/maininterface/mainctx.cpp
Changes:
=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -1101,15 +1101,20 @@ void MainCtx::setAttachedToolTip(QObject *toolTip)
// Check if the attached tooltip is actually the
// one that is set
#ifndef NDEBUG
- QQmlComponent component(engine);
- component.setData(QByteArrayLiteral("import QtQuick; import QtQuick.Controls; Item { }"), {});
- QObject* const obj = component.create();
- assert(obj);
- // Consider disabling setting of custom attached
- // tooltip if the following assertion fails:
- if (QQmlProperty::read(obj, QStringLiteral("ToolTip.toolTip"), qmlContext(obj)).value<QObject*>() != toolTip)
- qmlWarning(obj) << "Could not set self as custom ToolTip!";
- obj->deleteLater();
+ QMetaObject::invokeMethod(toolTip, [toolTip]() {
+ const auto engine = qmlEngine(toolTip);
+ if (Q_UNLIKELY(!engine)) // Very unlikely, if not impossible
+ return;
+ QQmlComponent component(engine);
+ component.setData(QByteArrayLiteral("import QtQuick; import QtQuick.Controls; Item { }"), {});
+ QObject* const obj = component.create();
+ assert(obj);
+ // Consider disabling setting of custom attached
+ // tooltip if the following assertion fails:
+ if (QQmlProperty::read(obj, QStringLiteral("ToolTip.toolTip"), qmlContext(obj)).value<QObject*>() != toolTip)
+ qmlWarning(obj) << "Could not set self as custom ToolTip!";
+ obj->deleteLater();
+ }, Qt::QueuedConnection);
#endif
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e1d73e29995a2c5239971a186d38338b5bfb54c9
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e1d73e29995a2c5239971a186d38338b5bfb54c9
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list