Changeset 1318 for trunk/dll


Ignore:
Timestamp:
Dec 5, 2008, 2:57:40 AM (17 years ago)
Author:
Gregg Young
Message:

Fix dbl free error for deletes by disabling fSyncUpdates for deletes; ironically the container now update faster then with it on. Also improved failure of container to update following an archive extract. It now should work for all but may be the largest archives (based on root filenames). It work with the largest I could find.

Location:
trunk/dll
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.c

    r1304 r1318  
    780780                            MPFROMP(pci),
    781781                            MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    782           if (!pciC) {
    783             Stubby(dcd->hwndCnr, pci);
    784             DosSleep(0); //26 Aug 07 GKY 1
     782          if (!pciC) {
     783            Stubby(dcd->hwndCnr, pci);
     784            //DosSleep(1); //26 Aug 07 GKY 1
    785785          }
    786786        }
    787787        pci = WinSendMsg(dcd->hwndCnr,
    788788                         CM_QUERYRECORD,
    789                         MPFROMP(pci), MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     789                        MPFROMP(pci), MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    790790      }
    791791      dcd->firsttree = TRUE;
     
    844844        PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__);
    845845
    846         if (hwndMain) {
     846        if (hwndMain) {
    847847          if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame && pszTempDir)
    848848            if (!WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID))
     
    36563656            CommonCreateTextChildren(dcd->hwndClient,
    36573657                                     WC_DIRSTATUS, ids);
    3658           }
     3658          }
    36593659          if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
    36603660            WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
  • trunk/dll/mainwnd.c

    r1315 r1318  
    7070  01 Sep 08 GKY Save toolbars immediately on change. Add bmps for default toolbars
    7171  29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate.
    72   03 Dec 08 GKY Use StubbyScanCount to prevent scan of "last" directory container prior to
     72  04 Dec 08 GKY Use event semaphore to prevent scan of "last" directory container prior to
    7373                tree scan completion; prevents duplicate directory names in tree.
    7474
     
    415415      henum = WinBeginEnumWindows(hwndMain);
    416416      while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
    417         // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
     417         //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
    418418        if (hwndC != exclude && hwndC != hwndTree) {
    419419          id = WinQueryWindowUShort(hwndC, QWS_ID);
     
    434434                               UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
    435435                  MakeValidDir(ret);
    436                   // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
     436                  //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
    437437                  WinEndEnumWindows(henum);
    438438                  return hwndC;
     
    31873187    PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    31883188  }
     3189  DosWaitEventSem(DriveScanStart, 20000);
    31893190  size = (ULONG)0;
    31903191  sprintf(szKey, "%sTargetDir", szPrefix);
     
    59315932          continue;
    59325933        if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) {
    5933           DosSleep(10); // Give time for StubbyScanThreads to start
    5934           while (StubbyScanCount !=0)
    5935             DosSleep(50);
    59365934          OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
    59375935        }
  • trunk/dll/update.c

    r1242 r1318  
    575575        if (RemoveCnrItems(hwndCnr, pci, 1,
    576576                           CMA_FREE |
    577                              numremain == 1 ? CMA_INVALIDATE : 0) != -1) {
     577                           numremain == 1 ? CMA_INVALIDATE : 0) != -1) {
     578          pci = NULL;
    578579          numremain--;
    579580          repos = TRUE;
  • trunk/dll/worker.c

    r1316 r1318  
    3030                drives list if it exists. Fix ability to deselect use of trash can.
    3131  01 Sep 08 GKY Add code to retry on Netdrives "pipe error"
     32  04 Dec 08 GKY Add a DosSleep to allow file extract to complete before rescan
     33  04 Dec 08 GKY Add mutex semaphore and disable fSyncUpdates for file deletes to prevent the creation
     34                on dead CNRITEMS.
    3235
    3336***********************************************************************/
     
    474477                  if (needs_quoting(ex.masks) && !strchr(ex.masks, '\"'))
    475478                    maskspaces = TRUE;
    476                   if (!runemf2(SEPARATE | WINDOWED |
     479                  if (!runemf2(SEPARATE | WINDOWED | WAIT |
    477480                               fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED),
    478481                               HWND_DESKTOP, pszSrcFile, __LINE__, ex.extractdir, NULL,
     
    483486                               *ex.masks ? ex.masks : "\"*\"",
    484487                               maskspaces ? "\"" : NullStr) &&
    485                       !stricmp(ex.extractdir, wk->directory)) {
    486                     if (WinIsWindow(hab2, wk->hwndCnr))
     488                      !stricmp(ex.extractdir, wk->directory)) {
     489                    DosSleep(100); // wait for runemf2 to complete so rescan will actually show something
     490                    if (WinIsWindow((HAB) 0, wk->hwndCnr))
    487491                      WinSendMsg(wk->hwndCnr,
    488492                                 WM_COMMAND,
     
    15971601                if (!wk->li->list || !wk->li->list[0])
    15981602                  break;
    1599               }
     1603              }
     1604              DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
    16001605              for (x = 0; wk->li->list[x]; x++) {
    16011606                fsa.attrFile = 0;
     
    16221627                  DosReleaseMutexSem(hmtxFM2Delete);
    16231628                }
    1624                 else {
     1629                else {
     1630                  DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08
    16251631                  /*sprintf(prompt,
    16261632                          GetPString(IDS_DELETINGTEXT), wk->li->list[x]);
     
    16441650                    }
    16451651                    else {
    1646                       DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
     1652                      //DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
    16471653                      error = DosDelete(wk->li->list[x]);
    1648                       DosReleaseMutexSem(hmtxFM2Delete);
     1654                      //DosReleaseMutexSem(hmtxFM2Delete);
    16491655                    }
    16501656                  }
    16511657                  else {
    1652                     DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
     1658                    //DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
    16531659                    error = DosForceDelete(wk->li->list[x]);
    1654                     DosReleaseMutexSem(hmtxFM2Delete);
     1660                    //DosReleaseMutexSem(hmtxFM2Delete);
    16551661                  }
    16561662                  if (error) {
     
    16741680                      }
    16751681                      else {
    1676                         DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
     1682                       // DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
    16771683                        error = DosDelete(wk->li->list[x]);
    1678                         DosReleaseMutexSem(hmtxFM2Delete);
     1684                       // DosReleaseMutexSem(hmtxFM2Delete);
    16791685                      }
    16801686                    }
    16811687                    else {
    1682                       DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
     1688                      //DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
    16831689                      error = DosForceDelete(wk->li->list[x]);
    1684                       DosReleaseMutexSem(hmtxFM2Delete);
     1690                      //DosReleaseMutexSem(hmtxFM2Delete);
    16851691                    }
    16861692                  }
    1687                 }
     1693                  DosReleaseMutexSem(hmtxFM2Delete);
     1694                }
    16881695                if (error) {
    16891696                  if (LogFileHandle)
     
    17081715                  AddNote(prompt);
    17091716                }
    1710                 if (fSyncUpdates ||
    1711                     AddToList(wk->li->list[x], &files, &numfiles, &numalloc))
     1717                if (//fSyncUpdates ||
     1718                    AddToList(wk->li->list[x], &files, &numfiles, &numalloc)) {
    17121719                  Broadcast(hab2,
    17131720                            wk->hwndCnr,
    17141721                            UM_UPDATERECORD,
    1715                             MPFROMP(wk->li->list[x]), MPVOID);
    1716               }
     1722                            MPFROMP(wk->li->list[x]), MPVOID);
     1723                }
     1724              }
    17171725            }
    17181726            break;
Note: See TracChangeset for help on using the changeset viewer.