vcl/osx/a11ywrapper.mm |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit c10a242bf1c9c0460d0ed19f2925a91abd3d0c8b
Author:     Patrick Luby <patrick.l...@collabora.com>
AuthorDate: Wed Apr 12 17:17:12 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Thu Apr 13 18:29:50 2023 +0200

    Related: tdf#153374 Don't release autoreleased attributeNames
    
    Also, return an autoreleased empty array instead of a retained array.
    
    Change-Id: I5f494b301dbae859486d6bc4874112b714022b60
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150307
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@neooffice.org>
    (cherry picked from commit 127eacf630e1712fd5addcabed404b2d33752311)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150316
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>

diff --git a/vcl/osx/a11ywrapper.mm b/vcl/osx/a11ywrapper.mm
index 73abb6050733..c4beeb5b0567 100644
--- a/vcl/osx/a11ywrapper.mm
+++ b/vcl/osx/a11ywrapper.mm
@@ -807,8 +807,13 @@ static std::ostream &operator<<(std::ostream &s, NSObject 
*obj) {
         if ( [ self accessibleValue ] ) {
             [ AquaA11yValueWrapper addAttributeNamesTo: attributeNames ];
         }
-        [ nativeSubrole release ];
-        [ title release ];
+        if ( nativeSubrole ) {
+            [ nativeSubrole release ];
+        }
+        if ( title ) {
+            [ title release ];
+        }
+        // Related: tdf#153374 Don't release autoreleased attributeNames
         return attributeNames;
     } catch ( DisposedException & ) { // Object is no longer available
         if ( nativeSubrole ) {
@@ -817,11 +822,10 @@ static std::ostream &operator<<(std::ostream &s, NSObject 
*obj) {
         if ( title ) {
             [ title release ];
         }
-        if ( attributeNames ) {
-            [ attributeNames release ];
-        }
+        // Related: tdf#153374 Don't release autoreleased attributeNames
+        // Also, return an autoreleased empty array instead of a retained 
array.
         [ AquaA11yFactory removeFromWrapperRepositoryFor: [ self 
accessibleContext ] ];
-        return [ [ NSArray alloc ] init ];
+        return [ NSArray array ];
     }
 }
 

Reply via email to