vcl/osx/DataFlavorMapping.cxx | 3 --- vcl/osx/a11yactionwrapper.mm | 2 +- vcl/osx/a11ywrapper.mm | 12 +++++++----- 3 files changed, 8 insertions(+), 9 deletions(-)
New commits: commit 29ef1d698c7f8bb38c0af21215a24577ced656ff Author: Patrick Luby <[email protected]> AuthorDate: Thu May 30 17:28:41 2024 -0400 Commit: Noel Grandin <[email protected]> CommitDate: Fri May 31 09:55:59 2024 +0200 Fix some macOS memory leaks due to overretaining Objective-C objects Change-Id: If826476ad6c6692d22519f4eb0fb45621240fdbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168271 Reviewed-by: Patrick Luby <[email protected]> Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/vcl/osx/DataFlavorMapping.cxx b/vcl/osx/DataFlavorMapping.cxx index 96dd5501e355..d02582653f6d 100644 --- a/vcl/osx/DataFlavorMapping.cxx +++ b/vcl/osx/DataFlavorMapping.cxx @@ -732,10 +732,7 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const css::uno::Sequence<c const NSString* str = openOfficeToSystemFlavor(flavors[i], bNeedDummyInternalFlavor, bIsSystemClipboard); if (str != nullptr) - { - [str retain]; [array addObject: str]; - } } } diff --git a/vcl/osx/a11yactionwrapper.mm b/vcl/osx/a11yactionwrapper.mm index 77d670c958b6..f9c5089a19ea 100644 --- a/vcl/osx/a11yactionwrapper.mm +++ b/vcl/osx/a11yactionwrapper.mm @@ -61,7 +61,7 @@ [ actionNames addObject: [ AquaA11yActionWrapper nativeActionNameFor: [ CreateNSString ( [ wrapper accessibleAction ] -> getAccessibleActionDescription ( cnt ) ) autorelease ] ] ]; } } - return actionNames; + return [actionNames autorelease]; } +(void)doAction:(NSString *)action ofElement:(AquaA11yWrapper *)wrapper { diff --git a/vcl/osx/a11ywrapper.mm b/vcl/osx/a11ywrapper.mm index 292fb6dcc6d1..c35f02cdae53 100644 --- a/vcl/osx/a11ywrapper.mm +++ b/vcl/osx/a11ywrapper.mm @@ -352,14 +352,15 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) { } } } - return children; + return [children autorelease]; } else if ( [ self accessibleTable ] ) { AquaA11yTableWrapper* pTable = [self isKindOfClass: [AquaA11yTableWrapper class]] ? static_cast<AquaA11yTableWrapper*>(self) : nil; return [ AquaA11yTableWrapper childrenAttributeForElement: pTable ]; } else { + NSMutableArray * children = [ [ NSMutableArray alloc ] init ]; + try { - NSMutableArray * children = [ [ NSMutableArray alloc ] init ]; Reference< XAccessibleContext > xContext( [ self accessibleContext ] ); try { @@ -397,12 +398,13 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) { } } - [ children autorelease ]; - return NSAccessibilityUnignoredChildren( children ); + return NSAccessibilityUnignoredChildren( [ children autorelease ] ); } catch (const Exception &) { // TODO: Log - return nil; } + + [ children autorelease ]; + return [NSArray array]; } }
