Skip to content

Commit

Permalink
[#40] Track Map: General improvements and bugfixes (Part 24: Fixed co…
Browse files Browse the repository at this point in the history
…ncurrent access to the disk)
  • Loading branch information
tomas-nestorovic committed Dec 25, 2021
1 parent 3b978b7 commit 4e8e4b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Main/src/ViewTrackMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,19 @@
break;
const div_t d=div(trackNumber,nHeads);
// . scanning the Track to draw its Sector Statuses
{ EXCLUSIVELY_LOCK_IMAGE(*image);
if (!::IsWindow(pvtm->m_hWnd)) // TrackMap may not exist if, for instance, switched to another view while still scanning some Track(s)
continue;
ti.cylinder=d.quot, ti.head=d.rem;
//if (pvtm->displayType==TDisplayType::STATUS) // commented out because this scanning always needed
ti.nSectors=image->ScanTrack( ti.cylinder, ti.head, nullptr, ti.bufferId, ti.bufferLength, ti.bufferStartNanoseconds );
}
// . scanning the Track to draw its Sector data
if (pvtm->displayType>=TDisplayType::DATA_OK_ONLY){
TFdcStatus statuses[(TSector)-1];
EXCLUSIVELY_LOCK_IMAGE(*image);
if (!::IsWindow(pvtm->m_hWnd)) // TrackMap may not exist if, for instance, switched to another view while still scanning some Track(s)
continue;
image->GetTrackData( ti.cylinder, ti.head, Revolution::CURRENT, ti.bufferId, sectorIdAndPositionIdentity, ti.nSectors, ti.bufferSectorData, ti.bufferLength, statuses );
for( TSector n=0; n<ti.nSectors; n++ )
if (pvtm->displayType!=TDisplayType::DATA_ALL && !statuses[n].IsWithoutError())
Expand Down Expand Up @@ -638,6 +645,7 @@
// - disposing the RainbowPens (assuming that the FillerByte color is a stock object)
for( int t=TRACK_MAP_COLORS_COUNT; t--; ::DeleteObject(rainbowBrushes[t]) );
// - base
EXCLUSIVELY_LOCK_IMAGE(*IMAGE);
__super::OnDestroy();
}

Expand Down

0 comments on commit 4e8e4b7

Please sign in to comment.