Changeset 1856 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Aug 18, 2015, 7:12:52 PM (10 years ago)
Author:
Steven Levine
Message:

Rework Flesh/Stubby etc. to avoid running on thread 1
Should be ready for release after spurious traps resolved
DbgMsg calls retained - delete/disable before release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r1828 r1856  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001-2012 Steven H. Levine
     9  Copyright (c) 2001, 2015 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    7878  15 Sep 09 SHL Use UM_GREP when passing pathname
    7979  15 Nov 09 GKY Add semaphore to fix double names in tree container caused by UM_SHOWME
    80                 before scan completes
     80                before scan completes
    8181  22 Nov 09 GKY Add LVM.EXE to partition submenu
    8282  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast
    83                 CHAR CONSTANT * as CHAR *.
     83                CHAR CONSTANT * as CHAR *.
    8484  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
    85                 never being posted
     85                never being posted
    8686  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
    87                 entries in the tree container, fix related semaphore performance using
    88                 combination of event and mutex semaphores
     87                entries in the tree container, fix related semaphore performance using
     88                combination of event and mutex semaphores
    8989  04 Aug 12 GKY Fix trap reported by Ben
    9090  30 Dec 12 GKY Changed refresh removable media to query LVM directly to call Rediscover_PRMs (Ticket 472);
    91                 Also added a tree rescan following volume detach.
     91                Also added a tree rescan following volume detach.
    9292  22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories.
    9393  07 Sep 14 GKY Fix tree container mis-draws (stacked icons with RWS) The problem was magnified
    94                 by RWS but I think the occasional extra blank directory or duplicating
    95                 directories is related.
     94                by RWS but I think the occasional extra blank directory or duplicating
     95                directories is related.
    9696  16 Mar 15 GKY Add semaphore hmtxFiltering to prevent freeing dcd while filtering. Prevents
    97                 a trap when FM2 is shutdown or the container is closed while tree
    98                 container is still populating
     97                a trap when FM2 is shutdown or the container is closed while tree
     98                container is still populating
    9999  02 May 15 GKY Changes to allow a JAVA executable object to be created using "Real object"
    100                 menu item on a jar file.
     100                menu item on a jar file.
    101101  12 Jul 15 GKY Fixed trap caused by pci->pszFileName being NullStr
     102  07 Aug 15 SHL Rework to use AddFleshWorkRequest rather than direct calls to Stubby/Flesh/Unflesh
    102103
    103104***********************************************************************/
     
    141142#include "select.h"                     // ExpandAll
    142143#include "findrec.h"                    // FindCnrRecord, FindParentRecord, ShowCnrRecord
    143 #include "flesh.h"                      // Flesh, UnFlesh
     144#include "flesh.h"                      // AddFleshWorkRequest
    144145#include "notify.h"                     // HideNote
    145146#include "objwin.h"                     // MakeObjWin
     
    165166#include "dirs.h"                       // save_dir2
    166167#include "fortify.h"
    167 #include "init.h"                       // GetTidForWindow
     168#include "init.h"                       // NullStr etc.
    168169#include "excputil.h"                   // xbeginthread
    169170#include "copyf.h"                      // ignorereadonly
     
    273274}
    274275
     276/**
     277 * Find a record in tree view, move it so it shows in container and
     278 * make it the current record
     279 * @param hwndCnr is container which must be in tree view
     280 * @param pszDir_ is full path name to find
     281 */
     282
    275283VOID ShowTreeRec(HWND hwndCnr,
    276                  CHAR *dirname,
     284                 CHAR *pszDir_,
    277285                 BOOL collapsefirst,
    278286                 BOOL maketop)
    279287{
    280     /**
    281      * Find a record in tree view, move it so it shows in container and
    282      * make it the current record
    283      */
    284 
    285   PCNRITEM pci, pciToSelect, pciP;
     288  PCNRITEM pci;
     289  PCNRITEM pciToSelect;
     290  PCNRITEM pciP;
     291  UINT retries;
    286292  BOOL quickbail = FALSE;
    287   CHAR szDir[CCHMAXPATH], *p;
     293  PSZ p;
     294  UINT cDirLen;
     295  BOOL found;
     296  CHAR szDir[CCHMAXPATH];
     297
     298  DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec pszDir_ %s", pszDir_); // 2015-08-04 SHL FIXME debug
    288299
    289300  // already positioned to requested record?
     
    291302                   CM_QUERYRECORDEMPHASIS,
    292303                   MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
    293   if (pci && (INT) pci != -1 && !stricmp(pci->pszFileName, dirname)) {
    294     quickbail = TRUE;                   // Bypass repositioning
     304  if (pci && (INT)pci != -1 && !stricmp(pci->pszFileName, pszDir_)) {
     305    found = TRUE;
     306    quickbail = TRUE;                   // Already at requested record - bypass repositioning
    295307    goto MakeTop;
    296308  }
     309
    297310  WinEnableWindowUpdate(hwndCnr, FALSE);
    298   pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
    299   if (!pci || (INT) pci == -1) {
    300     *szDir = *dirname;
     311
     312  // 2015-08-13 SHL add retry logic
     313  for (found = FALSE, retries = 0; !found && retries < 10; retries++) {
     314
     315    pci = FindCnrRecord(hwndCnr,
     316                        pszDir_,
     317                        NULL,           // pciParent
     318                        TRUE,           // partial
     319                        FALSE,          // partmatch
     320                        TRUE);          // noenv
     321
     322    if (pci && (INT)pci != -1) {
     323      found = TRUE;
     324      break;                    // Found it
     325    }
     326
     327    // Try again expanding as needed
     328
     329    DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec need expand"); // 2015-08-04 SHL FIXME debug
     330
     331    cDirLen = strlen(pszDir_);
     332
     333    *szDir = *pszDir_;                  // Drive letter
    301334    szDir[1] = ':';
    302335    szDir[2] = '\\';
    303336    szDir[3] = 0;
    304337    p = szDir + 3;                      // Point after root backslash
     338
    305339    for (;;) {
    306       pciP = FindCnrRecord(hwndCnr, szDir, NULL, TRUE, FALSE, TRUE);
    307       if (pciP && (INT) pciP != -1) {
    308         if (!stricmp(dirname, pciP->pszFileName))
    309           break;                        // Found it
    310         if (~pciP->rc.flRecordAttr & CRA_EXPANDED)
    311           WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    312         strcpy(szDir, dirname);
    313         if (p - szDir >= strlen(szDir))
    314           break;                        // Not root dir
    315         p = strchr(p, '\\');
    316         if (p) {
    317           *p = 0;                       // fixme?
    318           p++;
    319         }
    320         else
    321           break;
    322       }
    323       else
    324         break;
    325       DosSleep(0);
    326     } // for
    327     pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
    328   }
    329   if (pci && (INT) pci != -1) {
     340      // Try to match path prefix
     341      pciP = FindCnrRecord(hwndCnr,
     342                           szDir,
     343                           NULL,                // pciParent
     344                           TRUE,                // partial
     345                           FALSE,               // partmatch
     346                           TRUE);               // noenv
     347      if (!pciP || (INT)pciP == -1) {
     348        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(%s) returned %p", szDir, pciP); // 2015-08-04 SHL FIXME debug
     349        WaitFleshWorkListEmpty();               // 2015-08-13 SHL
     350        DosSleep(1000);
     351        break;                                  // No match
     352      }
     353
     354      DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord returned %p %s", pciP, pciP->pszFileName); // 2015-08-04 SHL FIXME debug
     355
     356      if (!stricmp(pszDir_, pciP->pszFileName)) {
     357        pci = pciP;
     358        found = TRUE;
     359        break;                  // Got full match
     360      }
     361
     362      if (~pciP->rc.flRecordAttr & CRA_EXPANDED) {
     363        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec expanding %s", pciP->pszFileName); // 2015-08-04 SHL FIXME debug
     364        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
     365        DosSleep(100);                          // 2015-08-13 SHL Let PM catch up
     366        // WaitFleshWorkListEmpty();            // 2015-08-13 SHL
     367      }
     368
     369      WaitFleshWorkListEmpty();         // 2015-08-13 SHL
     370
     371      // Add next component to path
     372      if (p - szDir >= cDirLen)
     373        break;                          // Done
     374      strcpy(szDir, pszDir_);           // Reset
     375      p = strchr(p, '\\');              // Find next backslash
     376      if (!p)
     377        break;                          // Give up
     378
     379      *p++ = 0;                         // Truncate at backslash
     380
     381    } // while expanding
     382
     383  } // for
     384
     385  DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec retries %u pci %p pci->pszFileName %s",retries, pci, pci && (INT)pci != -1 ? pci->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
     386
     387  if (found) {
     388    // Found it
    330389    if (~pci->rc.flRecordAttr & CRA_CURSORED) {
    331390      if (collapsefirst) {
     
    334393                          MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    335394        while (pciP && (INT) pciP != -1) {
    336 #if 1 // 05 Jan 08 SHL fixme to be sure this is correct code
    337395          if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
    338396            // collapse top level of all branches
    339397            WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
    340398          }
    341 #else // fixme to be gone
    342           if (toupper(*pciP->pszFileName) == toupper(*dirname)) {
    343             // collapse all levels if branch is our drive
    344             if (pciP->rc.flRecordAttr & CRA_EXPANDED)
    345               ExpandAll(hwndCnr, FALSE, pciP);
    346           }
    347           else if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
    348             // collapse top level of all branches
    349             WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
    350           }
    351 #endif
    352399          pciP = WinSendMsg(hwndCnr,
    353400                            CM_QUERYRECORD,
     
    355402                            MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    356403        } // while
    357       }
    358       // expand all parent branches
     404      } // if collapse
     405
     406      // Expand parent branches
     407      // 2015-08-06 SHL FIXME to bypass if we did not collapse since search already expanded - maybe?
    359408      pciToSelect = pci;
    360409      for (;;) {
     
    363412                          MPFROMP(pciToSelect),
    364413                          MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
    365         if (pciP && (INT) pciP != -1) {
    366           if (!(pciP->rc.flRecordAttr & CRA_EXPANDED))
    367             WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    368           pciToSelect = pciP;
    369         }
    370         else
    371           break;
     414        if (!pciP || (INT)pciP == -1)
     415          break;                        // Done
     416        // Got parent
     417        if (~pciP->rc.flRecordAttr & CRA_EXPANDED)
     418          WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
     419        pciToSelect = pciP;
    372420        DosSleep(0);                    // Let GUI update
    373421      } // for
    374     }
     422    } // if not cursored
     423
     424  MakeTop:
    375425    // make record visible
    376   MakeTop:
    377426    pciToSelect = pci;
    378427    if (pciToSelect && (INT) pciToSelect != -1) {
    379       //DbgMsg(pszSrcFile, __LINE__, "TOP %i %i", fTopDir, maketop);
     428      DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec %p fTopDir %i maketop %i", pciToSelect, fTopDir, maketop); // 2015-08-04 SHL FIXME debug
    380429      if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED)
    381         WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    382       if (fTopDir || maketop) {
    383         ShowCnrRecord(hwndCnr, (PMINIRECORDCORE) pciToSelect);
    384       }
     430        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
     431      if (fTopDir || maketop)
     432        ShowCnrRecord(hwndCnr, (PMINIRECORDCORE)pciToSelect);
     433
    385434      if (!quickbail) {
     435        WaitFleshWorkListEmpty();       // 2015-08-07 SHL FIXME try to ensure contents stable
     436        DbgMsg(pszSrcFile, __LINE__, "WinSendMsg(CM_SETRECORDEMPHASIS, CRA_SELECTED | CRA_CURSORED) \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
    386437        WinSendMsg(hwndCnr,
    387438                   CM_SETRECORDEMPHASIS,
     
    391442    }
    392443  }
     444
    393445  WinEnableWindowUpdate(hwndCnr, TRUE);
    394446}
     
    649701}
    650702
     703ULONG ulScanPostCnt;
     704
    651705MRESULT EXPENTRY TreeObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    652706{
    653707  DIRCNRDATA *dcd;
     708
     709#if 0 // 2015-08-04 SHL FIXME to be gone
     710  APIRET rc;
     711#endif // 2015-08-04 SHL FIXME to be gone
    654712
    655713  switch (msg) {
     
    661719      dcd = INSTDATA(hwnd);
    662720      if (dcd) {
    663         BOOL tempsusp, tempfollow, temptop;
    664 
    665         DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
    666         tempsusp = dcd->suspendview;
    667         dcd->suspendview = TRUE;
    668         tempfollow = fFollowTree;
    669         fFollowTree = FALSE;
    670         if (mp2) {
    671           temptop = fTopDir;
    672           fTopDir = TRUE;
    673         }
    674         ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
    675         PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    676         dcd->suspendview = (USHORT) tempsusp;
    677         fFollowTree = tempfollow;
    678         if (mp2)
    679           fTopDir = temptop;
     721
     722#if 0 // 2015-08-04 SHL FIXME to be gone
     723        rc = DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     724        if (rc)
     725          Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     726#endif // 2015-08-04 SHL FIXME to be gone
     727
     728        /* Hold off if switching on focus change and
     729           RestoreDirCnrState has restored one or directory directory containers
     730           See RestoreDirCnrState()
     731        */
     732        DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME cDirectoriesRestored %u", cDirectoriesRestored, fInitialDriveScan); // 2015-08-04 SHL FIXME debug
     733        DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME %s)", mp1); // 2015-08-04 SHL FIXME debug
     734
     735        if (cDirectoriesRestored > 0)
     736          cDirectoriesRestored--;
     737
     738        if (!cDirectoriesRestored) {
     739          BOOL tempsusp = dcd->suspendview;
     740          BOOL tempfollow = fFollowTree;
     741          BOOL temptop;
     742          dcd->suspendview = TRUE;
     743          fFollowTree = FALSE;
     744          if (mp2) {
     745            temptop = fTopDir;
     746            fTopDir = TRUE;
     747          }
     748
     749          DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling ShowTreeRec(\"%s\")", mp1); // 2015-08-04 SHL FIXME debug
     750          ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
     751          DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling PostMsg(IDM_UPDATE)"); // 2015-08-04 SHL FIXME debug
     752          PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
     753
     754          dcd->suspendview = (USHORT)tempsusp;  // Restore
     755          fFollowTree = tempfollow;             // Restore
     756          if (mp2)
     757            fTopDir = temptop;                  // Restore
     758        }
    680759      }
    681760      free((CHAR *)mp1);
     
    717796      dcd->suspendview = TRUE;
    718797      ExpandAll(dcd->hwndCnr,
    719                 (SHORT1FROMMP(mp1) == IDM_EXPAND), (PCNRITEM) mp2);
     798                (SHORT1FROMMP(mp1) == IDM_EXPAND), (PCNRITEM) mp2);
    720799      DosSleep(1); // Fixes tree epansion (dir text and icons all placed on
    721                        // the same line as the drive) failure on startup using RWS
     800                       // the same line as the drive) failure on startup using RWS
    722801      dcd->suspendview = (USHORT) tempsusp;
    723802      PostMsg(dcd->hwndCnr, UM_FILTER, MPVOID, MPVOID);
     
    789868      if (cnri.cRecords) {
    790869        sprintf(s, GetPString(IDS_NUMDRIVESTEXT), cnri.cRecords);
    791         if (pci && (INT) pci != -1 && pci->pszFileName != NullStr) { //fixme? will try checking pci->pszFileName instead of the pointer
     870        if (pci && (INT) pci != -1 && pci->pszFileName != NullStr) { //fixme? will try checking pci->pszFileName instead of the pointer
    792871          if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
    793872                DRIVE_REMOVABLE) ||
     
    809888              }
    810889              else
    811                 *szFree = 0;
    812               //Show information on status line not shown in the tree container
     890                *szFree = 0;
     891              //Show information on status line not shown in the tree container
    813892              driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
    814               if (CheckDrive(toupper(*pci->pszFileName), FileSystem, &type) == -1 ||
    815                   fShowFSTypeInTree)
     893              if (CheckDrive(toupper(*pci->pszFileName), FileSystem, &type) == -1 ||
     894                  fShowFSTypeInTree)
    816895                strcpy(FileSystem, NullStr);
    817896              if (fShowDriveLabelInTree)
     
    826905                sprintf(s,
    827906                        GetPString(fShowFSTypeInTree ? IDS_TREESTATUSSTART1TEXT :
    828                                    fShowDriveLabelInTree ? IDS_TREESTATUSSTART2TEXT :
    829                                    IDS_TREESTATUSSTARTTEXT), toupper(*pci->pszFileName),
    830                         FileSystem, szTmpLabel, volser.serial, szFree);
     907                                   fShowDriveLabelInTree ? IDS_TREESTATUSSTART2TEXT :
     908                                   IDS_TREESTATUSSTARTTEXT), toupper(*pci->pszFileName),
     909                        FileSystem, szTmpLabel, volser.serial, szFree);
    831910                strcat(s, temp);
    832911              }
     
    835914                sprintf(&s[strlen(s)],
    836915                        GetPString(fShowFSTypeInTree ? IDS_TREESTATUSSTART1TEXT :
    837                                    fShowDriveLabelInTree ? IDS_TREESTATUSSTART2TEXT :
    838                                    IDS_TREESTATUSSTARTTEXT), toupper(*pci->pszFileName),
    839                         FileSystem, szTmpLabel, volser.serial, szFree);
     916                                   fShowDriveLabelInTree ? IDS_TREESTATUSSTART2TEXT :
     917                                   IDS_TREESTATUSSTARTTEXT), toupper(*pci->pszFileName),
     918                        FileSystem, szTmpLabel, volser.serial, szFree);
    840919                strcat(s, "]");
    841920              }
     
    861940            pci = FindParentRecord(dcd->hwndCnr, pci);
    862941            driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    863             UnFlesh(dcd->hwndCnr, pci);
    864           }
    865         }
    866       }
    867       // 21 Sep 09 SHL fixme to know why checking again - focus change?
     942            WaitFleshWorkListEmpty();   // 2015-08-13 SHL in case pci still in work list
     943            AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
     944          }
     945        }
     946      }
     947      // 21 Sep 09 SHL FIXME to know why checking again - focus change?
    868948      if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent))
    869949        WinSetWindowText(hwndStatus, s);
     
    873953  case UM_RESCAN:
    874954    // populate container
    875     DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
    876     DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     955#if 0 // 2015-08-04 SHL FIXME to be gone
     956    rc = DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     957    if (rc)
     958      Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosWaitEventSem");
     959    rc = DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     960    if (rc)
     961      Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosResetEventSem");
     962#endif // 2015-08-04 SHL FIXME to be gone
     963
    877964    dcd = WinQueryWindowPtr(hwnd, QWL_USER);
    878965    if (!dcd)
     
    885972                 CM_SCROLLWINDOW,
    886973                 MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(-1));
     974      DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc FillTreeCnr()"); // 2015-08-04 SHL FIXME debug
    887975      FillTreeCnr(dcd->hwndCnr, dcd->hwndParent);
    888976      if (fOkayMinimize) {
     
    892980      WinSendMsg(dcd->hwndCnr,
    893981                 CM_INVALIDATERECORD,
    894                  MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
     982                 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
     983      DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc PostMsg(UM_RESCAN)"); // 2015-08-04 SHL FIXME debug
    895984      PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
    896985    }
     
    9171006      case IDM_DELETE:
    9181007      case IDM_PERMDELETE:
    919         if (li->type == IDM_DELETE)
    920           ignorereadonly = FALSE;
     1008        if (li->type == IDM_DELETE)
     1009          ignorereadonly = FALSE;
    9211010        if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
    9221011          return (MRESULT) TRUE;
     
    10371126  DIRCNRDATA *dcd = INSTDATA(hwnd);
    10381127  PCNRITEM pci;
     1128  APIRET rc;
    10391129
    10401130  switch (msg) {
     
    11241214        WinSetWindowText(hwndStatus2, NullStr);
    11251215    }
    1126     // 13 Jul 09 SHL fixme to make sense
     1216    // 13 Jul 09 SHL FIXME to make sense
    11271217    if (msg == UM_TIMER)
    11281218      return 0;
     
    11381228      FSALLOCATE fsa;
    11391229
    1140       pci = (PCNRITEM) CurrentRecord(hwnd);
    1141       if (pci && (INT) pci != -1) {
     1230      pci = (PCNRITEM)CurrentRecord(hwnd);
     1231      if (pci && (INT)pci != -1) {
    11421232        if (IsRoot(pci->pszFileName) || !DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
    11431233                                                       FSIL_ALLOC, &fsa,
     
    12351325        else
    12361326          WinSetWindowText(WinWindowFromID(dcd->hwndFrame,
    1237                                            MAIN_STATUS), pci->pszFileName);
     1327                                           MAIN_STATUS), pci->pszFileName);
    12381328        if (fMoreButtons && hwndName) {
    12391329          CHAR szDate[DATE_BUF_BYTES];
     
    12481338        }
    12491339      }
     1340      DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_RESCAN PostMsg(UM_RESCAN2, %s)", pci->pszFileName); // 2015-08-04 SHL FIXME debug
    12501341      PostMsg(dcd->hwndObject, UM_RESCAN2, MPFROMP(pci), MPVOID);
    12511342      if (hwndStatus2)
     
    15151606            }
    15161607          }
    1517           pDItem = DrgQueryDragitemPtr(pDInfo,          // Access DRAGITEM
    1518                                        0);              // Index to DRAGITEM
    1519           if (DrgVerifyRMF(pDItem,                      // Check valid rendering
     1608          pDItem = DrgQueryDragitemPtr(pDInfo,          // Access DRAGITEM
     1609                                       0);              // Index to DRAGITEM
     1610          if (DrgVerifyRMF(pDItem,                      // Check valid rendering
    15201611                           (CHAR *) DRM_OS2FILE,        // mechanisms and data
    1521                            NULL) || DrgVerifyRMF(pDItem,
    1522                                                 (CHAR *) DRM_FM2ARCMEMBER,
    1523                                                 (CHAR *) DRF_FM2ARCHIVE)) {    // formats
    1524             DrgFreeDraginfo(pDInfo);                    // Free DRAGINFO
     1612                           NULL) || DrgVerifyRMF(pDItem,
     1613                                                (CHAR *) DRM_FM2ARCMEMBER,
     1614                                                (CHAR *) DRF_FM2ARCHIVE)) {    // formats
     1615            DrgFreeDraginfo(pDInfo);                    // Free DRAGINFO
    15251616            if (!pci || (INT) pci == -1)
    15261617              return MRFROM2SHORT(DOR_DROP, DO_MOVE);
     
    15301621            if (toupper(*pci->pszFileName) < 'C')
    15311622              return MRFROM2SHORT(DOR_DROP, DO_COPY);
    1532             return MRFROM2SHORT(DOR_DROP,               // Return okay to drop
     1623            return MRFROM2SHORT(DOR_DROP,               // Return okay to drop
    15331624                                ((fCopyDefault) ? DO_COPY : DO_MOVE));
    15341625          }
    1535           DrgFreeDraginfo(pDInfo);                      // Free DRAGINFO
    1536         }
    1537         return MRFROM2SHORT(DOR_NODROP, 0);             // Drop not valid
     1626          DrgFreeDraginfo(pDInfo);                      // Free DRAGINFO
     1627        }
     1628        return MRFROM2SHORT(DOR_NODROP, 0);             // Drop not valid
    15381629
    15391630      case CN_INITDRAG:
     
    17541845      case CN_CONTEXTMENU:
    17551846        {
    1756           PCNRITEM pci = (PCNRITEM) mp2;
     1847          PCNRITEM pci = (PCNRITEM)mp2;
    17571848          BOOL wasFollowing;
    17581849
    1759           //DosEnterCritSec(); //GKY 11-28-08
    17601850          wasFollowing = fFollowTree;
    17611851          fFollowTree = FALSE;
    1762           //DosExitCritSec();
    1763           if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
    1764             WinSendMsg(hwnd,
    1765                        CM_SETRECORDEMPHASIS,
    1766                        MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
    1767             MarkAll(hwnd, FALSE, FALSE, TRUE);
    1768             if (!(pci->attrFile & FILE_DIRECTORY))
    1769               dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
    1770             else if (!IsRoot(pci->pszFileName))
    1771               dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
    1772             else
    1773               dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &TreeMenu, TREE_POPUP);
     1852          if (pci && (INT)pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
     1853            // 2015-08-09 SHL try to ensure contents stable
     1854            if (!IsFleshWorkListEmpty())
     1855              WinPostMsg(hwnd, msg, mp1, mp2);          // Try again later
     1856            else {
     1857              WinSendMsg(hwnd,
     1858                         CM_SETRECORDEMPHASIS,
     1859                         MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
     1860              MarkAll(hwnd, FALSE, FALSE, TRUE);
     1861              if (!(pci->attrFile & FILE_DIRECTORY))
     1862                dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
     1863              else if (!IsRoot(pci->pszFileName))
     1864                dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
     1865              else
     1866                dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &TreeMenu, TREE_POPUP);
     1867            }
    17741868          }
    17751869          else {
     
    17981892            }
    17991893          }
    1800           //DosEnterCritSec(); //GKY 11-28-08
    18011894          fFollowTree = wasFollowing;
    1802           //DosExitCritSec();
    18031895        }
    18041896        break;
     
    18371929                    driveserial[toupper(*pci->pszFileName) - 'A'] !=
    18381930                    volser.serial)
    1839                   UnFlesh(hwnd, pci);
     1931                {
     1932                  WaitFleshWorkListEmpty();     // 2015-08-13 SHL in case pci still in work list
     1933                  AddFleshWorkRequest(hwnd, pci, eUnFlesh);
     1934                }
    18401935                if (SHORT2FROMMP(mp1) != CN_COLLAPSETREE ||
    18411936                    (!volser.serial ||
    18421937                     driveserial[toupper(*pci->pszFileName) - 'A'] !=
    18431938                     volser.serial)) {
    1844                   if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && Flesh(hwnd, pci)
    1845                       &&!dcd->suspendview  && fTopDir) {
     1939                  if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && AddFleshWorkRequest(hwnd, pci, eFlesh)
     1940                      &&!dcd->suspendview  && fTopDir) {
    18461941                    PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    18471942                    //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
     
    18521947              else {
    18531948                driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    1854                 UnFlesh(hwnd, pci);
     1949                WaitFleshWorkListEmpty();       // 2015-08-13 SHL in case pci still in work list
     1950                AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    18551951                PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    18561952                if (!fAlertBeepOff)
     
    18591955            }
    18601956            else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
    1861               if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir){
     1957              // 2015-08-04 SHL
     1958#if 1
     1959              AddFleshWorkRequest(hwnd, pci, eFlesh);   // forceFlesh
     1960              if (!dcd->suspendview && fTopDir) {
     1961                DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_TOPDIR %p pci %p", hwnd, pci);  // 2015-08-04 SHL FIXME debug
    18621962                PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    1863                 //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    18641963              }
     1964#else
     1965              if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir) {
     1966                DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_TOPDIR %p pci %p", hwnd, pci);  // 2015-08-04 SHL FIXME debug
     1967                PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
     1968              }
     1969#endif
    18651970            }
    18661971            if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview){
     1972              DbgMsg(pszSrcFile, __LINE__, "UM_FILTER %p pci %p", hwnd, pci);
    18671973              WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
    1868               //DbgMsg(pszSrcFile, __LINE__, "UM_FILTER %p pci %p", hwnd, pci);
    18691974            }
    18701975          }
     
    18921997
    18931998      if (dir) {
     1999        DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_SHOWME PostMsg(UM_SHOWME, %s)", dir); // 2015-08-13 SHL FIXME debug
    18942000        if (!PostMsg(dcd->hwndObject, UM_SHOWME, MPFROMP(dir), MPVOID))
    18952001          free(dir);
     2002        else
     2003          SetFleshFocusDrive(*dir);
    18962004      }
    18972005    }
     
    19002008  case UM_TOPDIR:
    19012009    if (mp1) {
    1902 
    19032010      PCNRITEM pci = (PCNRITEM) mp1;
    1904 
    19052011      ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
    19062012    }
     
    19122018      HDIR hDir = HDIR_CREATE;
    19132019      ULONG nm = 1;
    1914       APIRET status;
     2020      // APIRET status;
    19152021      BOOL IsOk = FALSE;
    19162022      ULONG ulDriveNum, ulDriveMap;
     
    19192025      INT x;
    19202026
    1921       DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
    1922       DosQueryEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     2027#if 0 // 2015-08-04 SHL FIXME to be gone
     2028      rc = DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
     2029      if (rc)
     2030        Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosRequestMutexSem");
     2031#endif // 2015-08-04 SHL FIXME to be gone
     2032
     2033#if 0 // 2015-08-04 SHL FIXME to be gone
     2034      rc = DosQueryEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     2035      if (rc)
     2036        Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosQueryEventSem");
    19232037      if (ulScanPostCnt < 1)
    1924         return 0;
    1925       DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     2038        return 0;
     2039      rc = DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     2040      if (rc)
     2041        Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosResetEventSem");
     2042#endif // 2015-08-04 SHL FIXME to be gone
     2043
    19262044      if (fFollowTree)
    19272045        fl = 0;
     
    19382056          if (hwndStatus)
    19392057            WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_RESCANSUGTEXT));
    1940           DosPostEventSem(hevTreeCnrScanComplete);
     2058
     2059#if 0 // 2015-08-04 SHL FIXME to be gone
     2060          rc = DosPostEventSem(hevTreeCnrScanComplete);
     2061          if (rc && rc != ERROR_ALREADY_POSTED)
     2062            Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2063#endif // 2015-08-04 SHL FIXME to be gone
     2064
    19412065          return 0;
    19422066        }
     
    19582082            } // for
    19592083            RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE);
    1960             DosPostEventSem(hevTreeCnrScanComplete);
     2084
     2085#if 0 // 2015-08-04 SHL FIXME to be gone
     2086            rc = DosPostEventSem(hevTreeCnrScanComplete);
     2087            if (rc && rc != ERROR_ALREADY_POSTED)
     2088              Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2089#endif // 2015-08-04 SHL FIXME to be gone
    19612090            return 0;
    19622091          }
     
    19962125          memset(&volser, 0, sizeof(volser));
    19972126          DosError(FERR_DISABLEHARDERR);
    1998           status = DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
    1999                                   FSIL_VOLSER, &volser,
    2000                                   (ULONG) sizeof(volser));
    2001           if (!status) {
     2127          rc = DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
     2128                              FSIL_VOLSER, &volser,
     2129                              (ULONG) sizeof(volser));
     2130          if (!rc) {
    20022131            if (!volser.serial || driveserial[x] != volser.serial) {
     2132#if 1 // 2015-08-04 SHL FIXME to be gone
     2133              AddFleshWorkRequest(hwnd, pciP, eFlesh);  // forceFlesh
     2134#else
    20032135              Flesh(hwnd, pciP);
     2136#endif // 2015-08-04 SHL FIXME to be gone
    20042137              driveserial[x] = volser.serial;
    20052138            }
     
    20082141                              MPFROMP(pciP),
    20092142                              MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    2010             if (!pciL) {
    2011               Flesh(hwnd, pciP);
    2012             }
     2143            if (!pciL) {
     2144#if 1 // 2015-08-04 SHL FIXME to be gone
     2145              AddFleshWorkRequest(hwnd, pciP, eFlesh);  // forceFlesh
     2146#else
     2147              Flesh(hwnd, pciP);
     2148#endif // 2015-08-04 SHL FIXME to be gone
     2149            }
    20132150            if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
    20142151                strlen(pciP->pszFileName) < 4) {
     
    20272164          else {
    20282165            driveserial[x] = -1;
    2029             UnFlesh(hwnd, pci);
     2166            WaitFleshWorkListEmpty();   // 2015-08-13 SHL in case pci still in work list
     2167            AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    20302168            PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    2031             PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(status));
    2032             DosPostEventSem(hevTreeCnrScanComplete);
     2169            PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(rc));
     2170
     2171#if 0 // 2015-08-04 SHL FIXME to be gone
     2172            rc = DosPostEventSem(hevTreeCnrScanComplete);
     2173            if (rc && rc != ERROR_ALREADY_POSTED)
     2174              Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2175#endif // 2015-08-04 SHL FIXME to be gone
    20332176            return 0;
    20342177          }
    20352178        }
    2036         status = 0;
     2179        rc = 0;
    20372180        IsOk = (IsRoot(pci->pszFileName) &&
    20382181                IsValidDrive(toupper(*pci->pszFileName)));
    20392182        if (!IsOk) {
    20402183          DosError(FERR_DISABLEHARDERR);
    2041           status = DosFindFirst(pci->pszFileName, &hDir,
    2042                                 FILE_NORMAL | FILE_DIRECTORY |
    2043                                 FILE_ARCHIVED | FILE_READONLY |
    2044                                 FILE_HIDDEN | FILE_SYSTEM,
    2045                                 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
     2184          rc = DosFindFirst(pci->pszFileName, &hDir,
     2185                            FILE_NORMAL | FILE_DIRECTORY |
     2186                            FILE_ARCHIVED | FILE_READONLY |
     2187                            FILE_HIDDEN | FILE_SYSTEM,
     2188                            &ffb, sizeof(ffb), &nm, FIL_STANDARD);
    20462189          priority_bumped();
    20472190        }
    2048         if (!status) {
     2191        if (!rc) {
    20492192          if (!IsOk)
    20502193            DosFindClose(hDir);
     
    20532196              PostMsg(hwnd,
    20542197                      WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
    2055               DosPostEventSem(hevTreeCnrScanComplete);
     2198
     2199#if 0 // 2015-08-04 SHL FIXME to be gone
     2200              rc = DosPostEventSem(hevTreeCnrScanComplete);
     2201              if (rc && rc != ERROR_ALREADY_POSTED)
     2202                Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2203#endif // 2015-08-04 SHL FIXME to be gone
    20562204              return 0;
    20572205            }
    20582206            if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT)) {
    20592207              OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
    2060               DosPostEventSem(hevTreeCnrScanComplete);
     2208
     2209#if 0 // 2015-08-04 SHL FIXME to be gone
     2210              rc = DosPostEventSem(hevTreeCnrScanComplete);
     2211              if (rc && rc != ERROR_ALREADY_POSTED)
     2212                Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2213#endif // 2015-08-04 SHL FIXME to be gone
    20612214              return 0;
    20622215            }
     
    20642217              if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
    20652218                if (FindDirCnrByName(pci->pszFileName, TRUE)) {
    2066                   DosPostEventSem(hevTreeCnrScanComplete);
     2219
     2220#if 0 // 2015-08-04 SHL FIXME to be gone
     2221                  rc = DosPostEventSem(hevTreeCnrScanComplete);
     2222                  if (rc && rc != ERROR_ALREADY_POSTED)
     2223                    Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2224#endif // 2015-08-04 SHL FIXME to be gone
    20672225                  return 0;
    20682226                }
     
    20882246              }
    20892247              OpenObject(pci->pszFileName, s, dcd->hwndFrame);
    2090               DosPostEventSem(hevTreeCnrScanComplete);
     2248
     2249#if 0 // 2015-08-04 SHL FIXME to be gone
     2250              rc = DosPostEventSem(hevTreeCnrScanComplete);
     2251              if (rc && rc != ERROR_ALREADY_POSTED)
     2252                Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2253#endif // 2015-08-04 SHL FIXME to be gone
    20912254              return 0;
    20922255            }
     
    21232286        else {
    21242287          if (!IsRoot(pci->pszFileName)) {
    2125             NotifyError(pci->pszFileName, status);
     2288            NotifyError(pci->pszFileName, rc);
    21262289            RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE);
    21272290          }
     
    21322295      if (fFollowTree)
    21332296        WinSetFocus(HWND_DESKTOP, hwnd);
    2134       DosPostEventSem(hevTreeCnrScanComplete);
     2297
     2298#if 0 // 2015-08-04 SHL FIXME to be gone
     2299      rc = DosPostEventSem(hevTreeCnrScanComplete);
     2300      if (rc && rc != ERROR_ALREADY_POSTED)
     2301        Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     2302#endif // 2015-08-04 SHL FIXME to be gone
    21352303    }
    21362304    return 0;
     
    22352403            WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
    22362404            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
    2237             WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
    2238             WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVM, fLVM);
     2405            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
     2406            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVM, fLVM);
    22392407            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
    22402408
     
    22662434        WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
    22672435        WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
    2268         WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
    2269         WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVM, fLVM);
     2436        WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
     2437        WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVM, fLVM);
    22702438        WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
    22712439        break;
     
    23502518      dcd->suspendview = (USHORT) tempsusp;
    23512519      PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    2352       //DbgMsg(pszSrcFile, __LINE__, "UM_RESCAN %p pci %s", hwnd, (CHAR *) mp1);
    23532520    }
    23542521    return 0;
     
    23562523  case UM_DRIVECMD:
    23572524    if (mp1) {
     2525      DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_DRIVECMD ShowTreeRec(\"%s\")", mp1);
    23582526      ShowTreeRec(hwnd, (CHAR *)mp1, FALSE, TRUE);
     2527      DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc PostMsg(IDM_UPDATE)");
    23592528      PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    23602529    }
     
    23862555              RemoveCnrItems(hwnd, pci, 1, CMA_FREE);
    23872556            else
    2388               Flesh(hwnd, pci);
     2557              AddFleshWorkRequest(hwnd, pci, eFlesh);
    23892558          }
    23902559          if (info->prev)
     
    24612630                }
    24622631                apptail = info;
    2463               }
    2464               PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
     2632              }
     2633              PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    24652634            }
    24662635          }
     
    26122781                NULL, NULL,
    26132782                "%s", PCSZ_LVMGUICMD);
    2614         break;
     2783        break;
    26152784
    26162785      case IDM_PARTITIONLVM:
     
    26272796
    26282797      case IDM_REFRESHREMOVABLES:
    2629         {
    2630         PFN Rediscover_PRMs;
    2631         HMODULE hmod = 0;
    2632         APIRET rc;
    2633         CHAR objerr[CCHMAXPATH];
    2634 
    2635         rc = DosLoadModule(objerr, sizeof(objerr), "LVM", &hmod);
    2636         if (!rc) {
    2637           rc = DosQueryProcAddr(hmod, 70, NULL, &Rediscover_PRMs);
    2638           if (!rc)
     2798        {
     2799        PFN Rediscover_PRMs;
     2800        HMODULE hmod = 0;
     2801        CHAR objerr[CCHMAXPATH];
     2802
     2803        rc = DosLoadModule(objerr, sizeof(objerr), "LVM", &hmod);
     2804        if (!rc) {
     2805          rc = DosQueryProcAddr(hmod, 70, NULL, &Rediscover_PRMs);
     2806          if (!rc)
    26392807            Rediscover_PRMs(&rc);
    2640           DosFreeModule(hmod);
    2641         }
    2642         if (!rc)
     2808          DosFreeModule(hmod);
     2809        }
     2810        if (!rc)
    26432811          PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    2644         break;
    2645         }
     2812        break;
     2813        }
    26462814
    26472815      case IDM_SORTNAME:
     
    28022970      case IDM_UPDATE:
    28032971        {
    2804           PCNRITEM pci = (PCNRITEM)CurrentRecord(hwnd);
     2972          // 2015-08-07 SHL FIXME select
     2973          PCNRITEM pci;
     2974          if (!IsFleshWorkListEmpty())
     2975            break;                      // 2015-08-07 SHL hold off until stable
     2976          pci = (PCNRITEM)CurrentRecord(hwnd);
    28052977          if (pci && (INT)pci != -1) {
    28062978            struct
     
    28172989            if (pci->attrFile & FILE_DIRECTORY) {
    28182990              if (pci->flags & RECFLAGS_UNDERENV)
    2819                 break;
    2820               DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
    2821               DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    2822               UnFlesh(hwnd, pci);
     2991                break;
     2992
     2993#if 0 // 2015-08-04 SHL FIXME to be gone
     2994              rc = DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
     2995              if (rc)
     2996                Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosRequestMutexSem");
     2997#endif // 2015-08-04 SHL FIXME to be gone
     2998
     2999#if 0 // 2015-08-04 SHL FIXME to be gone
     3000              rc = DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
     3001              if (rc)
     3002                Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosResetEventSem");
     3003#endif // 2015-08-04 SHL FIXME to be gone
     3004
     3005              // Can't wait here
     3006              // WaitFleshWorkListEmpty();      // 2015-08-13 SHL in case pci still in work list
     3007              AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    28233008              // Check if drive type might need update
    28243009              if ((driveflag & (DRIVE_INVALID | DRIVE_NOPRESCAN)) ||
     
    28283013                if (driveflag & DRIVE_INVALID)
    28293014                  pci->rc.hptrIcon = hptrDunno;
    2830                 else  if (strlen(pci->pszFileName) < 4) {
     3015                else if (strlen(pci->pszFileName) < 4) {
    28313016                  SelectDriveIcon(pci);
    2832                   if (fShowFSTypeInTree || fShowDriveLabelInTree) {
    2833                     strcpy(szBuf, pci->pszFileName);
    2834                     strcat(szBuf, " [");
    2835                     strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
    2836                     strcat(szBuf, "]");
    2837                     pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
    2838                     pci->rc.pszIcon = pci->pszDisplayName;
    2839                   }
    2840                 }
     3017                  if (fShowFSTypeInTree || fShowDriveLabelInTree) {
     3018                    strcpy(szBuf, pci->pszFileName);
     3019                    strcat(szBuf, " [");
     3020                    strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
     3021                    strcat(szBuf, "]");
     3022                    pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
     3023                    pci->rc.pszIcon = pci->pszDisplayName;
     3024                  }
     3025                }
    28413026                WinSendMsg(hwnd,
    28423027                           CM_INVALIDATERECORD,
     
    28463031                  PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
    28473032              }
     3033              DbgMsg(pszSrcFile, __LINE__, " TreeCnrWndProc IDM_UPDATE %s", pci->pszFileName); // 2015-08-03 SHL FIXME debug
    28483034              if (~driveflag & DRIVE_INVALID)
    2849                 Flesh(hwnd, pci);
    2850               DosPostEventSem(hevTreeCnrScanComplete);
     3035                AddFleshWorkRequest(hwnd, pci, eFlesh);
     3036#if 0 // 2015-08-04 SHL FIXME to be gone
     3037              rc = DosPostEventSem(hevTreeCnrScanComplete);
     3038              if (rc && rc != ERROR_ALREADY_POSTED)
     3039                Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     3040#endif // 2015-08-04 SHL FIXME to be gone
    28513041            }
    28523042          }
     
    30213211            case IDM_MCIPLAY:
    30223212              action = UM_MASSACTION;
    3023             }
    3024             if (li->type == IDM_DELETE)
    3025               ignorereadonly = FALSE;
     3213            }
     3214            if (li->type == IDM_DELETE)
     3215              ignorereadonly = FALSE;
    30263216            if (SHORT1FROMMP(mp1) == IDM_SHADOW ||
    30273217                SHORT1FROMMP(mp1) == IDM_SHADOW2)
     
    31433333  case WM_DESTROY:
    31443334#   ifdef FORTIFY
    3145     DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %p TID %u", hwnd, GetTidForThread()); // 18 Jul 08 SHL fixme
     3335    DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %x TID %u", hwnd, GetTidForThread()); // 18 Jul 08 SHL FIXME
    31463336#   endif
    31473337    if (TreeCnrMenu)
Note: See TracChangeset for help on using the changeset viewer.