Changeset 1102 for trunk/dll/dircnrs.c

Show
Ignore:
Timestamp:
08/02/08 22:29:35 (4 months ago)
Author:
gyoung
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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.c

    r1084 r1102  
    4646  20 Jul 08 GKY Add save/append filename to clipboard. 
    4747                Change menu wording to make these easier to find 
     48  02 Aug 08 GKY Always pass temp variable point to treecnr UM_SHOWME to avoid 
     49                freeing dcd->directory early 
    4850 
    4951***********************************************************************/ 
     
    781783      } 
    782784      if (fSwitchTree && hwndTree) { 
     785        PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__); 
     786 
    783787        if (hwndMain) { 
    784           if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame) 
    785             WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), MPVOID); 
    786         } 
    787         else 
    788           WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), MPVOID); 
     788          if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame && pszTempDir) 
     789            if (!WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID)) 
     790              free(pszTempDir); 
     791        } 
     792        else { 
     793          if (pszTempDir) 
     794            if (!WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID)) 
     795              free(pszTempDir); 
     796        } 
    789797      } 
    790798      dcd->firsttree = FALSE; 
     
    13341342      LastDir = hwnd; 
    13351343      PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 
    1336       if (fSwitchTreeOnFocus && hwndTree && dcd && *dcd->directory) 
    1337         WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), MPVOID); 
     1344      if (fSwitchTreeOnFocus && hwndTree && dcd && *dcd->directory) { 
     1345        PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__); 
     1346 
     1347        if (pszTempDir) { 
     1348          if (!WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID)) 
     1349            free(pszTempDir); 
     1350        } 
     1351      } 
    13381352    } 
    13391353    break; 
     
    18431857 
    18441858      case IDM_FINDINTREE: 
    1845         if (hwndTree) 
    1846           WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), 
    1847                      MPFROMLONG(1L)); 
     1859        if (hwndTree) { 
     1860          PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__); 
     1861 
     1862          if (pszTempDir) { 
     1863            if (!WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), 
     1864                            MPFROMLONG(1L))) 
     1865              free(pszTempDir); 
     1866          } 
     1867        } 
    18481868        break; 
    18491869