diff options
author | Patrick Luby <guibmacdev@gmail.com> | 2024-06-20 11:11:54 -0400 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2024-06-27 12:36:07 +0200 |
commit | b9485aad85c48b4444220279f5499908c52f00f5 (patch) | |
tree | 54a1974d47d5a5b264bedd6516be970dec6d7827 /vcl/ios/DataFlavorMapping.cxx | |
parent | 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2 (diff) |
tdf#161461 stop crashing by retaining NSString
OUStringToNSString() returns an autoreleased NSString so it
needs to be retained for the life of maOfficeOnlyTypes.
Change-Id: Ic3777f818b7cada8e88e97965531fc0a7f2e825c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169290
Tested-by: Jenkins
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl/ios/DataFlavorMapping.cxx')
-rw-r--r-- | vcl/ios/DataFlavorMapping.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx index 14bf0f6f43d7..607f110222bb 100644 --- a/vcl/ios/DataFlavorMapping.cxx +++ b/vcl/ios/DataFlavorMapping.cxx @@ -421,10 +421,17 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor OfficeOnlyTypes::const_iterator it = maOfficeOnlyTypes.find(oOOFlavor.MimeType); if (it == maOfficeOnlyTypes.end()) - sysFlavor = maOfficeOnlyTypes[oOOFlavor.MimeType] - = OUStringToNSString(oOOFlavor.MimeType); + { + // tdf#161461 stop crashing by retaining NSString + // OUStringToNSString() returns an autoreleased NSString so it + // needs to be retained for the life of maOfficeOnlyTypes. + sysFlavor = maOfficeOnlyTypes[oOOFlavor.MimeType] = + [OUStringToNSString(oOOFlavor.MimeType) retain]; + } else + { sysFlavor = it->second; + } } return sysFlavor; |