freeze wxFileDialog (Issue #26659)

39 views
Skip to first unread message

FRANCK REVOLLE

unread,
Jul 6, 2026, 5:52:41 AM (2 days ago) Jul 6
to wx-...@googlegroups.com, Subscribed
Revolle created an issue (wxWidgets/wxWidgets#26659)

Bug description:

WxFileDialog freezes on third call

Expected vs observed behaviour:

Calling my

wxFileDialog openFileDialog(this, "open file", "", "", music file (*.txt;*.png;*.xml;*.mxl)|*.txt;*.png;*.xml;*.mxl", wxFD_OPEN | wxFD_FILE_MUST_EXIST);

1st time : OK
2nd Time : OK
3rd time : freeze in my openFileDialog.ShowModal() ( dirdlg.cpp : m_fileDialog->Show(owner);

Stack trace:

When freezing, clicking on "Pause" ( CTRL-ALT-BREAK ) in Visual Studio ; I have this stack :

expresseur.exe!wxMSWImpl::wxIFileDialog::Show(HWND__ * owner, int options, wxArrayString * pathsOut, wxString * pathOut) Ligne 338	C++
expresseur.exe!wxFileDialog::ShowIFileDialog(HWND__ * hWndParent) Ligne 1718	C++
expresseur.exe!wxFileDialog::ShowModal() Ligne 1278	C++

Patch or snippet allowing to reproduce the problem:

I cannot reproduce this issue in the sample wxWidgets Dialogs.vcxproj.
In my Expresseur github project , I've simplified the "OnOpen" to reproduce the issue :

// ...
EVT_MENU(wxID_OPEN, Expresseur::OnOpen)
//...
fileMenu->Append(wxID_OPEN, _("Open...\tCtrl+O"));
//...
void Expresseur::OnOpen(wxCommandEvent& WXUNUSED(event)) 
{
	wxFileDialog
		openFileDialog(this, "open file", "", "",
			"music file (*.txt;*.png;*.xml;*.mxl)|*.txt;*.png;*.xml;*.mxl", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
	if (openFileDialog.ShowModal() == wxID_CANCEL)
		return; // the user changed idea...
	wxString mfile = openFileDialog.GetPath();
}

To Reproduce:

Clik on menu "Open"
1st time : OK
2nd Time : OK
3rd time : freeze in my openFileDialog.ShowModal() ( dirdlg.cpp : m_fileDialog->Show(owner);

Platform and version information

  • wxWidgets version 3.3.3
  • wxWidgets port wxMSW
  • OS Windows 10 and 11 , debug and release
    • Desktop environment Visual Studio C++ 2022


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659@github.com>

VZ

unread,
Jul 6, 2026, 7:23:14 AM (2 days ago) Jul 6
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26659)

This looks like another case of #23578 but it is supposed to be fixed in 3.3.3, are you sure you have 6c4bee8 in the version you use?

In any case, I'm afraid it is going to be very difficult for us to do anything about it without being able to reproduce it. Please try to add the relevant code from your application to the sample in order to make it possible.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4892202159@github.com>

PB

unread,
Jul 6, 2026, 8:14:49 AM (2 days ago) Jul 6
to wx-...@googlegroups.com, Subscribed
PBfordev left a comment (wxWidgets/wxWidgets#26659)

Well, it should be easy for @Revolle to test, i.e. use the workaround from the other issue:

  1. Change the parent of the file dialog to nullptr.
  2. Add wxDIALOG_NO_PARENT flag when creating the file dialog.

But I don't think the original issue was related to number of times the dialog has been created.

Anyway, could not repro on WIn11 with

#include <wx/wx.h>
#include <wx/filedlg.h>

class MyFrame : public wxFrame
{
public:
    MyFrame(wxWindow* parent = nullptr) : wxFrame(parent, wxID_ANY, "Test")
    {
        wxMenuBar *menuBar = new wxMenuBar;
        wxMenu *menuFile = new wxMenu;

        menuFile->Append(wxID_OPEN);
        menuBar->Append(menuFile, "&File");
        SetMenuBar(menuBar);

        Bind(wxEVT_MENU, [this](wxCommandEvent&)
        {
            wxFileDialog openFileDialog(this, "open file", "", "",
                            
"music file (*.txt;*.png;*.xml;*.mxl)|*.txt;*.png;*.xml;*.mxl",
                            wxFD_OPEN | wxFD_FILE_MUST_EXIST);

	        if (openFileDialog.ShowModal() == wxID_CANCEL)
		        return
;
	        SetTitle(openFileDialog.GetPath());
        }, wxID_OPEN);
    }
};

class MyApp : public wxApp
{
    bool OnInit() override
    {
        (new MyFrame())->Show();
        return true;
    }
}; wxIMPLEMENT_APP(MyApp);


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4892647002@github.com>

VZ

unread,
Jul 6, 2026, 8:18:38 AM (2 days ago) Jul 6
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26659)

There was another problem reported there which only appeared on 2nd run. But, indeed, not 3rd.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4892683873@github.com>

FRANCK REVOLLE

unread,
Jul 7, 2026, 12:12:03 PM (23 hours ago) Jul 7
to wx-...@googlegroups.com, Subscribed
Revolle left a comment (wxWidgets/wxWidgets#26659)

In my Expresseur application : CoInitializeEx triggers a context where the freezing of wxFileDialog ShowModal() appears.

HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

If I do not call CoInitializeEx : no freeze
If I call CoInitializeEx : freeze (3rd time 90%, 2nd time 10%) on wxFileDialog ShowModal()
I need CoInitializeEx to manage MIDI and UART. If I do not use CoInitializeEx , I cannot use opensource libraries midiserialport and rtmidilib
I do not know the impact of CoInitializeEx in wxwidgets.
I try to reproduce in the sample wxWidgets Dialogs.vcxproj, adding CoInitializeEx : it does not trigger the freeze.
I've added CoInitializeEx on June 2025 in my project github Expresseur, in dev phase. So, the regression is potentially possible. I use a lot other ways to select the files : list, history, ...; and I often use one file per session, which can explain the non visibility of this regression in my Expresseur application. My Expresseur app works on Mac and PC since years, using wxWidgets.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4905887443@github.com>

Igor Korot

unread,
Jul 7, 2026, 12:35:32 PM (22 hours ago) Jul 7
to wx-...@googlegroups.com, Subscribed
Hi,
What’s your wx version?
What version of Windows you are testing on?

What is the backtrace at the time of the freeze?

Thank you.


--
You received this message because you are subscribed to the Google Groups "wx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-dev+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/wx-dev/wxWidgets/wxWidgets/issues/26659/4905887443%40github.com.

Lauri Nurmi

unread,
Jul 7, 2026, 12:46:21 PM (22 hours ago) Jul 7
to wx-...@googlegroups.com
Igor,

Literally all of these questions are already answered in the GitHub issue you are commenting. Did you look at it at all?

VZ

unread,
Jul 7, 2026, 2:13:00 PM (21 hours ago) Jul 7
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26659)

This looks very much like the other problem. Are you absolutely sure you use 3.3.3? You should be seeing the old style file dialog if you do when you show it after initializing COM in incompatible mode.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4907045650@github.com>

FRANCK REVOLLE

unread,
3:30 AM (7 hours ago) 3:30 AM
to wx-...@googlegroups.com, Subscribed
Revolle left a comment (wxWidgets/wxWidgets#26659)

In Visual Studiob C++ , debug mode
screenshot of the wxFileDialog Showmodal code (cf. first message ), after CoInitializeEx(NULL, COINIT_MULTITHREADED) ( OK first time, than freeze on 2nd or 3rd time ) :
open.png (view on web)
wxVERSION_STRING returns 3.3.3 in my "About" dialog box
333.png (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4912415550@github.com>

VZ

unread,
7:49 AM (3 hours ago) 7:49 AM
to wx-...@googlegroups.com, Subscribed

Closed #26659 as duplicate.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/26659/issue_event/27713127981@github.com>

VZ

unread,
7:49 AM (3 hours ago) 7:49 AM
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26659)

The only explanation I see is that something else in your program calls CoInitializeEx(COINIT_APARTMENTTHREADED) before wx code is executed. As the comment in wxIFileDialog::CanBeUsedWithAnOwner() explains, this function returns what we need only the first time it's called, so your only choices are:

  1. Remove your call to CoInitializeEx(COINIT_MULTITHREADED) from your code.
  2. Or replace it with CoInitializeEx(COINIT_APARTMENTTHREADED).
  3. Hack wx sources to set wxUSE_IFILEOPENDIALOG to 0 unconditionally.

In any case, I'm pretty sure it's the same thing as the other bug, so let's close this one.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4914460912@github.com>

PB

unread,
8:09 AM (3 hours ago) 8:09 AM
to wx-...@googlegroups.com, Subscribed
PBfordev left a comment (wxWidgets/wxWidgets#26659)

so your only choices are ...

The no-parent-for-the-dialog workaround does not work anymore (may be more feasible at least in some cases)?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4914616579@github.com>

VZ

unread,
8:17 AM (2 hours ago) 8:17 AM
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26659)

so your only choices are ...

The no-parent-for-the-dialog workaround does not work anymore (may be more feasible at least in some cases)?

I think this is too fragile, if anything goes wrong you still get a hang of your program. I wouldn't rely on it.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26659/4914676169@github.com>

Reply all
Reply to author
Forward
0 new messages