sal/cppunittester/cppunittester.cxx |   15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

New commits:
commit 81726f5af5fda25f0d92ffc8458d7f24eb16f408
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Jul 9 12:01:20 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Jul 9 15:02:44 2023 +0200

    No need to clean up the desktop, when the process is finishing
    
    It will be cleaned up anyway.
    
    Change-Id: I67b936ee0d89280555e6d595fd53957952900057
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154226
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 50910fecfdd7..fe723d6ab229 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -40,7 +40,6 @@
 #include <string>
 #include <sal/log.hxx>
 #include <sal/types.h>
-#include <comphelper/scopeguard.hxx>
 #include <cppunittester/protectorfactory.hxx>
 #include <osl/module.h>
 #include <osl/module.hxx>
@@ -407,20 +406,10 @@ static bool main2()
 #endif
     // Create a desktop, to avoid popups interferring with active user session,
     // because on Windows, we don't use svp vcl plugin for unit testing
-    HDESK hDesktop = nullptr;
-    comphelper::ScopeGuard desktopRestore(
-        [&hDesktop, hPrevDesktop = GetThreadDesktop(GetCurrentThreadId())]()
-        {
-            if (hDesktop)
-            {
-                SetThreadDesktop(hPrevDesktop);
-                CloseDesktop(hDesktop);
-            }
-        });
     if (getenv("CPPUNIT_DEFAULT_DESKTOP") == nullptr)
     {
-        hDesktop = CreateDesktopW(L"LO_CPPUNIT_DESKTOP", nullptr, nullptr, 0, 
GENERIC_ALL, nullptr);
-        if (hDesktop)
+        if (HDESK hDesktop
+            = CreateDesktopW(L"LO_CPPUNIT_DESKTOP", nullptr, nullptr, 0, 
GENERIC_ALL, nullptr))
             SetThreadDesktop(hDesktop);
     }
 #endif

Reply via email to