From 978e434d72cf713d3b14ea27d470dd9c556f57bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 11 Jan 2008 01:32:47 +0000 Subject: [PATCH] * 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 --- src/kits/tracker/PoseView.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index fd7fc5028d..28669539eb 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -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));