a11y atspi: Create local variable on stack

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

Pick-to: 6.10
Change-Id: I2985acb5bd3e2f89c60de2b4ffa77b2a78cb4eff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Michael Weghorn 2025-06-03 10:12:05 +02:00 committed by Volker Hilsheimer
parent 36b5854af5
commit 77f02471ed

View File

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