a11y atspi: Create local variable on stack

There is no reason to allocate the OrgA11yAtspiSocketInterface
object only used inside AtSpiAdaptor::registerApplication on
the heap.

Change-Id: I2985acb5bd3e2f89c60de2b4ffa77b2a78cb4eff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 77f02471ed263d514c6f6edd170b97d2f6e7b44e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Michael Weghorn 2025-06-03 10:12:05 +02:00 committed by Qt Cherry-pick Bot
parent 3915e017e7
commit 88977389d3

View File

@ -1543,13 +1543,12 @@ bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const Q
*/
void AtSpiAdaptor::registerApplication()
{
OrgA11yAtspiSocketInterface *registry;
registry = new OrgA11yAtspiSocketInterface(ATSPI_DBUS_NAME_REGISTRY ""_L1,
ATSPI_DBUS_PATH_ROOT ""_L1, m_dbus->connection());
OrgA11yAtspiSocketInterface registry(ATSPI_DBUS_NAME_REGISTRY ""_L1, ATSPI_DBUS_PATH_ROOT ""_L1,
m_dbus->connection());
QDBusPendingReply<QSpiObjectReference> reply;
QSpiObjectReference ref = QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(ATSPI_DBUS_PATH_ROOT));
reply = registry->Embed(ref);
reply = registry.Embed(ref);
reply.waitForFinished(); // TODO: make this async
if (reply.isValid ()) {
const QSpiObjectReference &socket = reply.value();
@ -1559,7 +1558,6 @@ void AtSpiAdaptor::registerApplication()
<< reply.error().name()
<< reply.error().message();
}
delete registry;
}
// Accessible