Changeset 1896


Ignore:
Timestamp:
Aug 14, 2022, 9:12:03 PM (3 years ago)
Author:
Gregg Young
Message:

Attempt to fix tree container corruption and rare trap when both switch on focaus change and switch on directory change are enabled.

Location:
trunk/dll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/findrec.c

    r1877 r1896  
    6666  pci = WinSendMsg(hwndCnr,
    6767                   CM_SEARCHSTRING, MPFROMP(&srch), MPFROMP(pciParent));
    68   while (pci && (INT) pci != -1) {
     68  while (pci && (INT) pci != -1 && pci->pszFileName) {
    6969    if (!noenv || (pci->flags & (RECFLAGS_ENV | RECFLAGS_UNDERENV)) == 0) {
    7070      // CNRITEM for file/directory
  • trunk/dll/treecnr.c

    r1883 r1896  
    724724      Fortify_BecomeOwner(mp1);
    725725#     endif
     726      xDosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    726727      dcd = INSTDATA(hwnd);
    727728      if (dcd) {
     
    749750      }
    750751      free((CHAR *)mp1);
     752      xDosReleaseMutexSem(hmtxFM2Globals);
    751753    }
    752754    return 0;
     
    835837      CHAR **list = (CHAR **) mp1;
    836838
     839      xDosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    837840      while (list[numentries])
    838841        numentries++;
    839842      if (numentries)
    840843        UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
     844      xDosReleaseMutexSem(hmtxFM2Globals);
    841845    }
    842846    return 0;
     
    901905      ULONG type;
    902906
     907      xDosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    903908      strcpy(s, GetPString(IDS_TREETEXT));
    904909      memset(&cnri, 0, sizeof(CNRINFO));
     
    909914      if (cnri.cRecords) {
    910915        sprintf(s, GetPString(IDS_NUMDRIVESTEXT), cnri.cRecords);
    911         if (pci && (INT) pci != -1) {
    912           if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
    913                 DRIVE_REMOVABLE) ||
    914               driveserial[toupper(*pci->pszFileName) - 'A'] != -1) {
     916        if (pci && (INT) pci != -1 && pci->pszFileName) {
     917            if (driveserial[toupper(*pci->pszFileName) - 'A'] != -1
     918                || !(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_REMOVABLE)) {
    915919            memset(&volser, 0, sizeof(volser));
    916920            DosError(FERR_DISABLEHARDERR);
     
    995999      if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent))
    9961000        WinSetWindowText(hwndStatus, s);
     1001      xDosReleaseMutexSem(hmtxFM2Globals);
    9971002    }
    9981003    return 0;
     
    10041009      Runtime_Error(pszSrcFile, __LINE__, NULL);
    10051010    else {
     1011      xDosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    10061012      RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
    10071013      WinSendMsg(dcd->hwndCnr,
     
    10191025                 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
    10201026      PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
     1027      xDosReleaseMutexSem(hmtxFM2Globals);
    10211028    }
    10221029    return 0;
Note: See TracChangeset for help on using the changeset viewer.