Changeset 1318 for trunk/dll/worker.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.