wxDialog hangs

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
stegemma
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon May 11, 2009 3:15 pm
Contact:

wxDialog hangs

Post by stegemma » Tue May 12, 2009 8:03 am

I'm come back to wxWidgets since some time and i've found an old problem, that i cannot solve. In a wxMDIChildFrame derived class, i try both wxFileSelector and wxFileDialog (copying code directly from the sample dialogs project) and both hangs the application, without showing any dialog. I've compiled both dialogs sample and my application (and libraries too) in Unicode Debug. The library has been compiled as linked lib not dll. The function wxDialog works fine in dialogs sample application so i think that there must be something bad in my application. The only difference i think could be to have it shown from an MDI application, while dialogs application is'nt MDI. My application is almost complex but still "standard", from a wxWidgets point of view.

I remember to not have that problem in wxWidgete 2.6.4 but i'm not sure about that.

I work on Windows Vista (bleah!), VC++ 2003 .NET, wxWidgets 2.8.10.

Any suggestion about some possible solution?

that's my code:

Code: Select all

wxFileDialog dialog(this, // i've tryed NULL and wxTheApp->GetTopWindow()
                    _T("Testing save file dialog"),
                    wxEmptyString,
                    _T("myletter.doc"),
                    _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
                    wxFD_SAVE|wxFD_OVERWRITE_PROMPT);

dialog.SetFilterIndex(1);

if (dialog.ShowModal() == wxID_OK)
{
    wxLogMessage(_T("%s, filter %d"),
                dialog.GetPath().c_str(), dialog.GetFilterIndex());
}

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Wed May 13, 2009 12:49 am

Can you use a debugger to see where it gets stuck?
can you reproduce this in a small sample?
"Keyboard not detected. Press F1 to continue"
-- Windows

stegemma
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon May 11, 2009 3:15 pm
Contact:

Post by stegemma » Wed May 13, 2009 5:18 am

Whel i use wxFileSelector, it hangs while calling GetSaveFileName:

Code: Select all

static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err)
{
    if ( style & wxFD_SAVE ? GetSaveFileName(of) : GetOpenFileName(of) )
        return true;
Some other simple test works, the true program doesn't. I've debugged in assembly and seen that it hangs in ntdll, in this little procedure:

Code: Select all

773E9A76  mov         edi,edi 
773E9A78  mov         dword ptr [esp+4],eax 
773E9A7C  mov         dword ptr [esp+8],ebx 
773E9A80  jmp         773CE46E 
773E9A85  lea         esp,[esp] 
773E9A8C  lea         esp,[esp] 
773E9A90  mov         edx,esp 
773E9A92  sysenter         
773E9A94  ret 
I don't think this could help very much. Maybe there are some bad parameters in compiler? This is the compiler command line that i use:

Code: Select all

/I "d:\wxMSW\include" /I "d:\a\Case\gSql" /I "d:\a\case\gcomp" /I "D:\A\Case\gBase" /I "D:\A\Case\mParser" /I "." /I "d:\a\Case\gSql\Odbc\Ligs" /I "D:\A\Case\gPDF" /I "C:\Programmi\Visual Leak Detector\include" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_WINDOWS" /D "NOPCH" /D "_CRTDBG_MAP_ALLOC" /D "_UNICODE" /D "UNICODE" /FD /EHsc /RTC1 /MTd /GS /GR /Fp"d:\ligs\case\debug\bModly/bModly.pch" /Fo"d:\ligs\case\debug\bModly/" /Fd"d:\ligs\case\debug\bModly.pdb" /W4 /nologo /c /Zi
That's all folks! ;)

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Wed May 13, 2009 6:35 am

I think you have come to the point where you need to comment out your code until it works. Strip everything to a bare minimum with the MDI interface in place. If the problems somehow vanishes you can also think of heap / stack corruption somehow.

It code you show just looks too trivial not to be noticed by someone else earlier, if that really hangs the dialog.

Have you tried the minimal sample with your code?

With regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

stegemma
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon May 11, 2009 3:15 pm
Contact:

Post by stegemma » Wed May 13, 2009 8:33 am

Thansk, your suggestion was helpfull. I've deleted almost all, from my application, and i've found the problem!!!

I was using "Visual Leak Detector" and maybe was that program that originates the problem.

I've just deleted

#include <vld.h>

from my sources and now it works!!!

Thanks for the support.

Post Reply