summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@digia.com>2012-12-13 14:53:46 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-09 13:09:42 +0100
commit4d670c5747618e056f22da5fc03e51fc01d5ad12 (patch)
tree0c152762eeb571a91d7453478d432ab8a2b654c6 /src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
parentbbb9abf7fb6ceb2c484c08b482a4e9144291d645 (diff)
More explicit QCocoaAccessibleElement memory mngmt
Don't autorelease in the elementWithInterface function, rename it to createElementWithInterface. The element can then be released immediately or autoreleased ("delete later"). Change-Id: I155a85404c34d756c1752eb7c24a7fb0f3cf2e77 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index d5841c1983..7c9ae963f6 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -68,9 +68,9 @@ static QAccessibleInterface *acast(void *ptr)
return self;
}
-+ (QCocoaAccessibleElement *)elementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent
++ (QCocoaAccessibleElement *)createElementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent
{
- return [[[self alloc] initWithInterface:anQAccessibleInterface parent:aParent] autorelease];
+ return [[self alloc] initWithInterface:anQAccessibleInterface parent:aParent];
}
- (void)dealloc {
@@ -136,7 +136,9 @@ static QAccessibleInterface *acast(void *ptr)
NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids];
for (int i = 0; i < numKids; ++i) {
QAccessibleInterface *childInterface = acast(accessibleInterface)->child(i);
- [kids addObject:[QCocoaAccessibleElement elementWithInterface:(void*)childInterface parent:self]];
+ QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithInterface:(void*)childInterface parent:self];
+ [kids addObject: element];
+ [element release];
}
return kids;
@@ -251,7 +253,9 @@ static QAccessibleInterface *acast(void *ptr)
}
// hit a child, forward to child accessible interface.
- QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithInterface:childInterface parent:self];
+ QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithInterface:childInterface parent:self];
+ [accessibleElement autorelease];
+
return [accessibleElement accessibilityHitTest:point];
}