iOS: Fix accessibility leak

Change-Id: I359ce521decbbb06376fc48689762f462c8706b0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-08-07 14:57:18 +02:00
parent 123741b64c
commit 0ad79dd0f0
2 changed files with 11 additions and 3 deletions

View File

@ -62,10 +62,11 @@
- (id)initWithQIOSWindow:(QT_PREPEND_NAMESPACE(QIOSWindow) *)window - (id)initWithQIOSWindow:(QT_PREPEND_NAMESPACE(QIOSWindow) *)window
{ {
if (self = [self initWithFrame:window->geometry().toCGRect()]) if (self = [self initWithFrame:window->geometry().toCGRect()]) {
m_qioswindow = window; m_qioswindow = window;
m_accessibleElements = [[NSMutableArray alloc] init];
}
m_accessibleElements = [[NSMutableArray alloc] init];
return self; return self;
} }
@ -104,6 +105,13 @@
return self; return self;
} }
- (void)dealloc
{
[m_accessibleElements release];
[super dealloc];
}
- (void)willMoveToWindow:(UIWindow *)newWindow - (void)willMoveToWindow:(UIWindow *)newWindow
{ {
// UIKIt will normally set the scale factor of a view to match the corresponding // UIKIt will normally set the scale factor of a view to match the corresponding

View File

@ -50,7 +50,7 @@
return; return;
QAccessible::Id accessibleId = QAccessible::uniqueId(iface); QAccessible::Id accessibleId = QAccessible::uniqueId(iface);
UIAccessibilityElement *elem = [[QMacAccessibilityElement alloc] initWithId: accessibleId withAccessibilityContainer: self]; UIAccessibilityElement *elem = [[QMacAccessibilityElement alloc] initWithId: accessibleId withAccessibilityContainer: self];
[m_accessibleElements addObject: elem]; [m_accessibleElements addObject:[elem autorelease]];
} }
- (void)createAccessibleContainer:(QAccessibleInterface *)iface - (void)createAccessibleContainer:(QAccessibleInterface *)iface