https://git.reactos.org/?p=reactos.git;a=commitdiff;h=946ee611a3a4ed0020f2eb8960314e5897379c56

commit 946ee611a3a4ed0020f2eb8960314e5897379c56
Author:     Mark Jansen <[email protected]>
AuthorDate: Sat Apr 4 18:37:18 2020 +0200
Commit:     Mark Jansen <[email protected]>
CommitDate: Sat Apr 4 19:55:31 2020 +0200

    [RAPPS] Ensure the download dialog is always destroyed
    Ideally, this entire download thing should be rewritten, but that is
    something for another day.
---
 base/applications/rapps/loaddlg.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/base/applications/rapps/loaddlg.cpp 
b/base/applications/rapps/loaddlg.cpp
index c5b7b06c880..213e4afb3ab 100644
--- a/base/applications/rapps/loaddlg.cpp
+++ b/base/applications/rapps/loaddlg.cpp
@@ -349,6 +349,7 @@ class CDownloadManager
     static CDowloadingAppsListView DownloadsListView;
     static CDownloaderProgress ProgressBar;
     static BOOL bCancelled;
+    static BOOL bModal;
     static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG 
ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText);
 public:
     static VOID Add(DownloadInfo info);
@@ -363,7 +364,8 @@ public:
 ATL::CSimpleArray<DownloadInfo>         CDownloadManager::AppsToInstallList;
 CDowloadingAppsListView                 CDownloadManager::DownloadsListView;
 CDownloaderProgress                     CDownloadManager::ProgressBar;
-BOOL                                    CDownloadManager::bCancelled;
+BOOL                                    CDownloadManager::bCancelled = FALSE;
+BOOL                                    CDownloadManager::bModal = FALSE;
 
 VOID CDownloadManager::Add(DownloadInfo info)
 {
@@ -452,8 +454,14 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND 
Dlg, UINT uMsg, WPARAM w
         return FALSE;
 
     case WM_CLOSE:
-        EndDialog(Dlg, 0);
-        //DestroyWindow(Dlg);
+        if (CDownloadManager::bModal)
+        {
+            ::EndDialog(Dlg, 0);
+        }
+        else
+        {
+            ::DestroyWindow(Dlg);
+        }
         return TRUE;
 
     default:
@@ -858,6 +866,7 @@ end:
 //TODO: Reuse the dialog
 VOID CDownloadManager::LaunchDownloadDialog(BOOL bIsModal)
 {
+    CDownloadManager::bModal = bIsModal;
     if (bIsModal)
     {
         DialogBoxW(hInst,

Reply via email to