Bug 141883 - Windows File Dialog hangs app when searching in 2 dialogs
Summary: Windows File Dialog hangs app when searching in 2 dialogs
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 151744 (view as bug list)
Depends on:
Blocks: Performance
  Show dependency treegraph
 
Reported: 2021-04-24 19:25 UTC by Matt K
Modified: 2023-02-27 13:25 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt K 2021-04-24 19:25:28 UTC
Description:
Bug 106282 fixed a crash in Windows File Dialog, but now there is a hang when searching in 2 dialogs.  The hang is due to Windows search processing and is reproducible in Firefox and even Windows File Explorer.  Newer apps like Windows Settings and Windows Feedback Hub use a new async File Dialog which launches each new dialog in a new PickerHost.exe process and returns the results back to the calling process, thus avoiding the hang.  However, these APIs only appear to be on Windows 10 (and maybe Win8?) and not on Win7.  It seems the only way to avoid this hang would be to either disallow multiple file dialogs or to implement a new process for each new File Dialog similar to PickerHost.exe.

Steps to Reproduce:
1. Open a blank Calc spreadsheet (titled "Untitled 1")
2. Select File > New > Spreadsheet (open new window titled "Untitled 2")
3. In "Untitled 2", select File > Open
4. In "Untitled 1", select File > Open and in that dialog go to "C:" and do a search for a unique string like "qqzz"
5. In "Untitled 2" dialog, go to "C:" and do a search for a unique string like "qqzz"
6. In "Untitled 1" dialog, click cancel and observe application hangs

Actual Results:
Application completely hung, never responds.  Have to kill it.

Expected Results:
Application cancels the search operation and returns to the main window without hanging.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
CPU threads: 12; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 1 Mike Kaganski 2021-04-27 01:53:00 UTC
I guess we could use something similar to https://gerrit.libreoffice.org/c/core/+/112370, and have it conditionally use the new API on newer Windows?
Comment 2 Matt K 2021-05-01 06:14:39 UTC
(In reply to Mike Kaganski from comment #1)
> I guess we could use something similar to
> https://gerrit.libreoffice.org/c/core/+/112370, and have it conditionally
> use the new API on newer Windows?

Unfortunately the new APIs don't allow customization of the file dialog, so there would be no options like "Save with password" on the Save dialog.

I did find that the MFC class CFileDialog can run on its own thread and can cancel a long-running search operation without crashing, and it allows the same existing customization of the file dialog.  So, I will convert the code to use MFC, which adds a new dependency to a package that you have to manually install in Visual Studio 2019.  Please let me know if there would be any concerns with this approach.
Comment 3 Mike Kaganski 2021-05-01 06:57:18 UTC
(In reply to Matt K from comment #2)
> So, I will convert the code
> to use MFC, which adds a new dependency to a package that you have to
> manually install in Visual Studio 2019.  Please let me know if there would
> be any concerns with this approach.

I think that we can't do that. Above all, IIUC MFC has an incompatible license.
Comment 4 Matt K 2021-05-03 23:22:56 UTC
(In reply to Mike Kaganski from comment #3)
> I think that we can't do that. Above all, IIUC MFC has an incompatible
> license.

I searched the Microsoft documentation and didn't find anything about a specific license for MFC.  It looks like it is free to use in any Windows application like the standard library would be.  Here are some key sections of the documentation:

- https://docs.microsoft.com/en-us/cpp/mfc/reference/application-settings-mfc-dll-wizard?view=msvc-160 : "Regular MFC DLL with MFC statically linked" : "you do not need to redistribute the MFC DLL with this type of project"
- https://docs.microsoft.com/en-us/cpp/windows/deploying-visual-cpp-application-by-using-the-vcpp-redistributable-package?view=msvc-160 : search for license -> "Do not display a license"
- https://docs.microsoft.com/en-us/cpp/windows/walkthrough-deploying-a-visual-cpp-application-to-an-application-local-folder?view=msvc-160 : MFC application without license
- https://docs.microsoft.com/en-us/cpp/windows/walkthrough-deploying-a-visual-cpp-application-by-using-a-setup-project?view=msvc-160 : MFC app without license
- https://docs.microsoft.com/en-us/cpp/mfc/tn033-dll-version-of-mfc?view=msvc-160 : "Shipping an application that uses the shared library requires that you ship MFCxx.DLL and other libraries with your program. MFCxx.DLL is freely redistributable like many DLLs, but you still must install the DLL in your SETUP program. Also, you'll have to ship the other redistributable libraries used both by your program and the MFC DLLs themselves." : "The release versions of the DLLs (MFCxx.DLL and MFCxxU.DLL) are freely redistributable"
- https://docs.microsoft.com/en-us/cpp/windows/redistributing-the-mfc-library?view=msvc-160 : page dedicated to redistributing the MFC library
- https://docs.microsoft.com/en-us/cpp/windows/determining-which-dlls-to-redistribute?view=msvc-160 : Lists MFC dlls to redistribute
- https://docs.microsoft.com/en-us/visualstudio/releases/2019/redistribution :
"Subject to the License Terms for the software, you may copy and distribute with your program any of the files within the following folder and its subfolders except as noted below. You may not modify these files.
[VisualStudioFolder]\VC\redist"
Comment 5 Xisco Faulí 2022-05-03 12:08:51 UTC
Dear Matt K,
This bug has been in ASSIGNED status for more than 3 months without any
activity. Resetting it to NEW.
Please assign it back to yourself if you're still working on this.
Comment 6 Telesto 2022-11-04 20:02:36 UTC
I'm unable to reproduce this
Version: 7.5.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9cd0f4c2d25462feba0ffcbd906c199273821243
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded
Comment 7 Buovjaga 2023-02-27 13:25:53 UTC
*** Bug 151744 has been marked as a duplicate of this bug. ***