Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.13.2, 5.14.2, 5.15.1
-
None
-
Win 10 (x64) v1909
Description
We have a large-ish Qt 5.13.2 application that would experience reproducible crashes when the user clicked certain buttons in the interface quickly in conditions that caused a number of Qt elements to be re-created. While we are unsure of the exact underlying issue, we have remediated the problem in a way that that might benefit others.
The crash appeared in QStyleHelper::isInstanceOf where it would attempt to obtain a role() from an invalid QAccessibleInterface object. We were able to prevent the crashes by making sure the QAccessibleInterface object was valid before asking it for a role. This appears to be similar to https://bugreports.qt.io/browse/QTBUG-47093.
We recommend changing the 3rd line of the function from
match = iface && iface->role() == role;
to
match = iface && iface->isValid() && iface->role() == role;
The code for QStyleHelper::isInstanceOf appears to be unchanged from 5.13.2 to the present, so we assume the same crash would occur in newer versions as well, but we have not tested to be sure.