wasm: fix accessibility crash on null parent
The code was a assuming that an a11y interface always has a parent, which is not the case for the root interface. Also factor out to a getWindow() function, to prepare for re-use later on. Pick-to: 6.5 Change-Id: I52a841bf94c712deb9603e8b9c2c878820c5f117 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
This commit is contained in:
parent
2443f2be07
commit
34c3682157
@ -113,17 +113,18 @@ emscripten::val QWasmAccessibility::getContainer(QWindow *window)
|
|||||||
|
|
||||||
emscripten::val QWasmAccessibility::getContainer(QAccessibleInterface *iface)
|
emscripten::val QWasmAccessibility::getContainer(QAccessibleInterface *iface)
|
||||||
{
|
{
|
||||||
QWindow *window = iface->window();
|
if (!iface)
|
||||||
if (!window) {
|
return emscripten::val::undefined();
|
||||||
//this is needed to add tabs as the window is not available
|
return getContainer(getWindow(iface));
|
||||||
if (iface->parent()->window()) {
|
}
|
||||||
window = iface->parent()->window();
|
|
||||||
} else {
|
|
||||||
return emscripten::val::undefined();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return getContainer(window);
|
QWindow *QWasmAccessibility::getWindow(QAccessibleInterface *iface)
|
||||||
|
{
|
||||||
|
QWindow *window = iface->window();
|
||||||
|
// this is needed to add tabs as the window is not available
|
||||||
|
if (!window && iface->parent())
|
||||||
|
window = iface->parent()->window();
|
||||||
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
emscripten::val QWasmAccessibility::getDocument(const emscripten::val &container)
|
emscripten::val QWasmAccessibility::getDocument(const emscripten::val &container)
|
||||||
|
@ -36,6 +36,7 @@ private:
|
|||||||
static emscripten::val getContainer(QAccessibleInterface *iface);
|
static emscripten::val getContainer(QAccessibleInterface *iface);
|
||||||
static emscripten::val getDocument(const emscripten::val &container);
|
static emscripten::val getDocument(const emscripten::val &container);
|
||||||
static emscripten::val getDocument(QAccessibleInterface *iface);
|
static emscripten::val getDocument(QAccessibleInterface *iface);
|
||||||
|
static QWindow *getWindow(QAccessibleInterface *iface);
|
||||||
|
|
||||||
emscripten::val createHtmlElement(QAccessibleInterface *iface);
|
emscripten::val createHtmlElement(QAccessibleInterface *iface);
|
||||||
void destroyHtmlElement(QAccessibleInterface *iface);
|
void destroyHtmlElement(QAccessibleInterface *iface);
|
||||||
|
Loading…
Reference in New Issue
Block a user