[Gtkradiant] [Bug 915] New: file_dialog may put garbage in file type dropdown if filter is NULL

gtkradiant@zerowing.idsoftware.com gtkradiant@zerowing.idsoftware.com
Fri, 07 Nov 2003 21:33:34 -0600


http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=915

           Summary: file_dialog may put garbage in file type dropdown if
                    filter is NULL
           Product: GtkRadiant
           Version: 1.3
          Platform: All
        OS/Version: Windows 2000/XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: editor
        AssignedTo: ttimo@idsoftware.com
        ReportedBy: rfm@collectivecomputing.com


This is with "Native GUI" on win32. 

Sometimes the the 'files of type' dropdown will contain garbage characters if
gtkmisc.cpp:file_dialog (aka m_pfnFileDialog) is called with a NULL filter
string. A side effect of this is that no files are shown in the file selection
area. You can work around this by manually putting a pattern in the 'file name'
area and pressing enter.

A somewhat reliable way to reproduce this seems to be to bring up an open file
dialog which does have a filter (load map, for example), close it, and then open
one that doesn't have a filter (gtkgensurf load, for example)

GtkGensurf is one place where file_dialog is called without a filter.

I suspect it is caused by 
   if (pattern)
    {
      ofn.nFilterIndex = 0;
      ofn.lpstrFilter = typelist.m_strWin32Filters;
    }
    else ofn.nFilterIndex = 1;

but trying to decipher microsofts description of the OPENFILENAME gave me a
headache: 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/CommonDialogBoxLibrary/CommonDialogBoxReference/CommonDialogBoxStructures/OPENFILENAME.asp

It seems to me the correct behaviour would be to have a default filter of "*.*"

A form of this bug also seems to exist in 1.2.x. The pattern for gensurfs file
dialogs seems to be whatever patern was specified in previous calls (i.e. you
will go to load a bitmap and the pattern will be *.map;*.reg).