sfx2/source/appl/openuriexternally.cxx |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit f8799964a0d2a3cbc07c7edde6f17b57f9c93e4f
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Tue Oct 26 10:43:53 2021 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Tue Oct 26 23:12:59 2021 +0200

    Fix a memory leak
    
    ...introduced with 5d5da77e82b6498dd73123ec0dc36d2315e279a1 "tdf#116305 Add
    timeout to help Windows bring browsers to the front".  (And remove a 
redundant
    return statement, which had originally been `return true;`.)
    
    Change-Id: Idf7fe33b25cd243e31eea460e4af325c84dae88b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124174
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/sfx2/source/appl/openuriexternally.cxx 
b/sfx2/source/appl/openuriexternally.cxx
index f3f6edf11eee..d149f63d257d 100644
--- a/sfx2/source/appl/openuriexternally.cxx
+++ b/sfx2/source/appl/openuriexternally.cxx
@@ -77,13 +77,13 @@ void URITools::openURI(const OUString& sURI, bool 
bHandleSystemShellExecuteExcep
 
 IMPL_LINK_NOARG(URITools, onOpenURI, Timer*, void)
 {
+    std::unique_ptr<URITools> guard(this);
     css::uno::Reference< css::system::XSystemShellExecute > exec(
         
css::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
     try {
         exec->execute(
             msURI, OUString(),
             css::system::SystemShellExecuteFlags::URIS_ONLY);
-        return;
     } catch (css::lang::IllegalArgumentException & e) {
         if (e.ArgumentPosition != 0) {
             throw css::uno::RuntimeException(
@@ -112,7 +112,6 @@ IMPL_LINK_NOARG(URITools, onOpenURI, Timer*, void)
             //TODO: avoid subsequent replaceFirst acting on previous 
replacement
         eb->run();
     }
-    delete this;
 }
 
 void sfx2::openUriExternally(const OUString& sURI, bool 
bHandleSystemShellExecuteException)

Reply via email to