Commit d95cc48a authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

Fix memory leak when building with a11y support

QAccessible::updateAccessibility() expects a pointer, but doesn't take
ownership of the argument and expects us to delete it after we've called
it. So just allocate the object on the stack like other users of this
API do.

Found by ASAN.
parent b410e7f0
......@@ -1259,8 +1259,10 @@ void TerminalDisplay::updateImage()
delete[] dirtyMask;
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(new QAccessibleEvent(this, QAccessible::VisibleDataChanged));
QAccessible::updateAccessibility(new QAccessibleTextCursorEvent(this, _usedColumns * screenWindow()->screen()->getCursorY() + screenWindow()->screen()->getCursorX()));
QAccessibleEvent dataChangeEvent(this, QAccessible::VisibleDataChanged);
QAccessible::updateAccessibility(&dataChangeEvent);
QAccessibleTextCursorEvent cursorEvent(this, _usedColumns * screenWindow()->screen()->getCursorY() + screenWindow()->screen()->getCursorX());
QAccessible::updateAccessibility(&cursorEvent);
#endif
}
......@@ -3143,7 +3145,8 @@ void TerminalDisplay::keyPressEvent(QKeyEvent* event)
emit keyPressedSignal(event);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(new QAccessibleTextCursorEvent(this, _usedColumns * screenWindow()->screen()->getCursorY() + screenWindow()->screen()->getCursorX()));
QAccessibleTextCursorEvent textCursorEvent(this, _usedColumns * screenWindow()->screen()->getCursorY() + screenWindow()->screen()->getCursorX());
QAccessible::updateAccessibility(&textCursorEvent);
#endif
event->accept();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment