Menu

#2930 Crash in open/save file dialog in Windows 7 libraries

obsolete: 8.5.10
open
9
2011-10-01
2011-10-01
eaducac
No

Open (and presumably Save) file dialogs crash in Windows 7 when attempting to open a file located in a Library (e.g. Documents, Pictures, Videos, Music). Opening the same file through its actual path works fine (i.e., clicking on Libraries, then Documents, then whatever.txt, then Open will crash; actually clicking through the folders C:\Users\bob\Documents, clicking whatever.txt, and clicking Open will work fine). I haven't actually run the code through a debugger to verify 100%, but I believe this is a bug in OFNHookProcA/W in tkWinDialog.c. Since Libraries are collections of folders, they're not represented by one single path, so calling SendMessage() with CDM_GETFOLDERPATH fails (returns < 0) when the user navigates to a Library in the dialog; this would cause the buffer size in OFNHookProc to be calculated incorrectly, which is what I believe is causing the crash.

I noticed this bug when trying to use tkinter.filedialog.askopenfilename() in Python 3.2.2 (Python 3.2 actually uses Tk 8.5.9, but the problematic SendMessage() code appears to be unchanged in 8.5.10, so I've filed this under the current version). I've attached a zip file containing a Python script to replicate the bug and C++ code to demonstrate how CDM_GETFOLDERPATH fails inside Libraries. Note that the dialog won't crash if you go into a folder inside a Library, as once you're inside that folder, there's a real, logical path for CDM_GETFOLDERPATH to return; it only fails if you select a file immediately inside the Library itself.

Discussion

  • eaducac

    eaducac - 2011-10-01

    Python script to replicate bug and C++ program demonstrating failure of CDM_GETFOLDERPATH in Libraries

     
  • Donal K. Fellows

    • labels: 318653 --> 37. [tk_get*File]
    • assigned_to: mdejong --> hobbs
     
  • Donal K. Fellows

    • priority: 5 --> 9
     
  • Francois VOGEL

    Francois VOGEL - 2012-08-22

    See also 3095112