xcb: Initialize accessibility lazily, since it requires an event-dispatcher
QSpiAccessibleBridge uses a D-BUS connection, which in turn uses socket notifiers and timers internally. Neither of these can be used before a event-dispatcher is in place, so we need to defer creation of the accessibility interface until later. We assume that clients will only call QXcbIntegration::accessibility() when an event-dispatcher is set up, but to be extra safe we do an assert, so that failures of this pre-condition will trigger at the place they are caused -- not as failures to register socket notifiers and timers in the D-BUS code. Change-Id: I4f9d8362a3f285c3da9045d1ff6b8e7b04570488 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
parent
4e20df5fc5
commit
3bcc44268e
@ -173,9 +173,6 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char
|
||||
|
||||
m_fontDatabase.reset(new QGenericUnixFontDatabase());
|
||||
m_inputContext.reset(QPlatformInputContextFactory::create());
|
||||
#if !defined(QT_NO_ACCESSIBILITY) && !defined(QT_NO_ACCESSIBILITY_ATSPI_BRIDGE)
|
||||
m_accessibility.reset(new QSpiAccessibleBridge());
|
||||
#endif
|
||||
}
|
||||
|
||||
QXcbIntegration::~QXcbIntegration()
|
||||
@ -333,6 +330,14 @@ QPlatformInputContext *QXcbIntegration::inputContext() const
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QPlatformAccessibility *QXcbIntegration::accessibility() const
|
||||
{
|
||||
#if !defined(QT_NO_ACCESSIBILITY_ATSPI_BRIDGE)
|
||||
if (!m_accessibility) {
|
||||
Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QXcbIntegration",
|
||||
"Initializing accessibility without event-dispatcher!");
|
||||
m_accessibility.reset(new QSpiAccessibleBridge());
|
||||
}
|
||||
#endif
|
||||
|
||||
return m_accessibility.data();
|
||||
}
|
||||
#endif
|
||||
|
@ -114,7 +114,7 @@ private:
|
||||
QScopedPointer<QPlatformInputContext> m_inputContext;
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QScopedPointer<QPlatformAccessibility> m_accessibility;
|
||||
mutable QScopedPointer<QPlatformAccessibility> m_accessibility;
|
||||
#endif
|
||||
|
||||
QScopedPointer<QPlatformServices> m_services;
|
||||
|
Loading…
Reference in New Issue
Block a user