Changeset 1102 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Aug 2, 2008, 10:29:35 PM (17 years ago)
Author:
Gregg Young
Message:

Make the variable passed to treecnr UM_RESCAN a pointer to a temp variable every where to avoid freeing pci->pszFileName or dcd->directory early

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r1079 r1102  
    4646  15 Feb 08 SHL Sync with settings menu rework
    4747  15 Feb 08 SHL Avoid death if tree container 0 width
     48  19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
     49  02 Aug 08 GKY Always pass temp variable point to UM_SHOWME to avoid freeing pci->pszFileName early
    4850
    4951***********************************************************************/
     
    674676      if (cnri.cRecords) {
    675677        sprintf(s, GetPString(IDS_NUMDRIVESTEXT), cnri.cRecords);
    676         if (pci) {
     678        if (pci && pci->pszFileName) {
    677679          if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
    678680                DRIVE_REMOVABLE) ||
     
    23542356      case IDM_FINDINTREE:
    23552357        {
    2356           CHAR dir[CCHMAXPATH];
     2358          PSZ pszTempDir;
    23572359          PCNRITEM pci;
    23582360
    23592361          pci = (PCNRITEM) CurrentRecord(hwnd);
    23602362          if (pci && (INT) pci != -1) {
    2361             strcpy(dir, pci->pszFileName);
    2362             MakeValidDir(dir);
     2363            pszTempDir = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
     2364            if (pszTempDir)
     2365              MakeValidDir(pszTempDir);
    23632366          }
    23642367          else
    2365             save_dir2(dir);
    2366           if (WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
    2367                         WalkAllDlgProc,
    2368                         FM3ModHandle, WALK_FRAME, MPFROMP(dir)) && *dir)
    2369             WinSendMsg(hwnd, UM_SHOWME, MPFROMP(dir), MPFROMLONG(1));
     2368            pszTempDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
     2369          if (pszTempDir) {
     2370            if (WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
     2371                          WalkAllDlgProc,
     2372                          FM3ModHandle, WALK_FRAME, MPFROMP(pszTempDir))) {
     2373              if (!WinSendMsg(hwnd, UM_SHOWME, MPFROMP(pszTempDir), MPFROMLONG(1)))
     2374                free(pszTempDir);
     2375            }
     2376            else
     2377              free(pszTempDir);
     2378          }
    23702379        }
    23712380        break;
     
    24402449          }
    24412450          else
    2442             save_dir2(newpath);
     2451            strcpy(newpath, pFM2SaveDirectory);
    24432452          if (!WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkAllDlgProc,
    24442453                         FM3ModHandle, WALK_FRAME,
Note: See TracChangeset for help on using the changeset viewer.