* Finally nailed down and fixed #355: apparently, if the pose info attribute

couldn't be read from a file, Tracker would try 10 times with a 10 ms
  timeout - but only if the creation time equals the modification time!
  That was obviously supposed to be a check if the file was recent...
  Now that computers are faster (even when running Haiku), it may 
  actually take less than one second to copy a file, so most files on
  the Haiku image satisfied this thoughtful and future-proof check.
  (And no, even the original BFS does not automatically increase the 
  modified time on close.)
* Now, mmlr came up with a better check: we just check the file's 
  creation time against the current time to see if it's a recent file.
  That should work a bit more reliable :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23376 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-01-11 01:32:47 +00:00
parent 41eebe0564
commit 978e434d72

View File

@ -755,12 +755,13 @@ BPoseView::SavePoseLocations(BRect *frameIfDesktop)
}
} else {
model->WriteAttrKillForegin(kAttrPoseInfo, kAttrPoseInfoForeign,
B_RAW_TYPE, 0, &poseInfo, sizeof(poseInfo));
if (desktop)
B_RAW_TYPE, 0, &poseInfo, sizeof(poseInfo)));
if (desktop) {
model->WriteAttrKillForegin(kAttrExtendedPoseInfo,
kAttrExtendedPoseInfoForegin,
B_RAW_TYPE, 0, extendedPoseInfo, extendedPoseInfoSize);
}
}
delete [] (char *)extendedPoseInfo;
@ -2541,6 +2542,8 @@ BPoseView::ReadPoseInfo(Model *model, PoseInfo *poseInfo)
}
} else {
ASSERT(model->IsNodeOpen());
time_t now = time(NULL);
for (int32 count = 10; count >= 0; count--) {
if (!model->Node())
break;
@ -2558,9 +2561,9 @@ BPoseView::ReadPoseInfo(Model *model, PoseInfo *poseInfo)
// pose info to properly place the icon
if (ViewMode() == kListMode)
break;
const StatStruct *stat = model->StatBuf();
if (stat->st_crtime != stat->st_mtime)
if (stat->st_crtime < now - 5)
break;
// PRINT(("retrying to read pose info for %s, %d\n", model->Name(), count));