Remove the monitor item before calling FSNotification() on it. Otherwise,
in some cases PoseView would call back into PoseCreatedOrMoved(), leading to an infinite recursion. Fixes #7696. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42229 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -53,13 +53,13 @@ PendingNodeMonitorEntry::NodeMonitor() const
|
|||||||
return &fNodeMonitor;
|
return &fNodeMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PendingNodeMonitorEntry::Match(const node_ref *node) const
|
PendingNodeMonitorEntry::Match(const node_ref *node) const
|
||||||
{
|
{
|
||||||
return fNode == *node;
|
return fNode == *node;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PendingNodeMonitorEntry::TooOld(bigtime_t now) const
|
PendingNodeMonitorEntry::TooOld(bigtime_t now) const
|
||||||
{
|
{
|
||||||
return now > fExpiresAfter;
|
return now > fExpiresAfter;
|
||||||
@@ -76,7 +76,7 @@ PendingNodeMonitorCache::~PendingNodeMonitorCache()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PendingNodeMonitorCache::Add(const BMessage *message)
|
PendingNodeMonitorCache::Add(const BMessage *message)
|
||||||
{
|
{
|
||||||
#if xDEBUG
|
#if xDEBUG
|
||||||
@@ -91,39 +91,38 @@ PendingNodeMonitorCache::Add(const BMessage *message)
|
|||||||
fList.AddItem(new PendingNodeMonitorEntry(&node, message));
|
fList.AddItem(new PendingNodeMonitorEntry(&node, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PendingNodeMonitorCache::RemoveEntries(const node_ref *nodeRef)
|
PendingNodeMonitorCache::RemoveEntries(const node_ref *nodeRef)
|
||||||
{
|
{
|
||||||
int32 count = fList.CountItems();
|
int32 count = fList.CountItems();
|
||||||
for (int32 index = count - 1; index >= 0; index--)
|
for (int32 index = count - 1; index >= 0; index--)
|
||||||
if (fList.ItemAt(index)->Match(nodeRef))
|
if (fList.ItemAt(index)->Match(nodeRef))
|
||||||
delete fList.RemoveItemAt(index);
|
delete fList.RemoveItemAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PendingNodeMonitorCache::RemoveOldEntries()
|
PendingNodeMonitorCache::RemoveOldEntries()
|
||||||
{
|
{
|
||||||
bigtime_t now = system_time();
|
bigtime_t now = system_time();
|
||||||
int32 count = fList.CountItems();
|
int32 count = fList.CountItems();
|
||||||
for (int32 index = count - 1; index >= 0; index--)
|
for (int32 index = count - 1; index >= 0; index--)
|
||||||
if (fList.ItemAt(index)->TooOld(now)) {
|
if (fList.ItemAt(index)->TooOld(now)) {
|
||||||
PRINT(("removing old entry from pending node monitor cache\n"));
|
PRINT(("removing old entry from pending node monitor cache\n"));
|
||||||
delete fList.RemoveItemAt(index);
|
delete fList.RemoveItemAt(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView *poseView, const BPose *pose)
|
PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView *poseView, const BPose *pose)
|
||||||
{
|
{
|
||||||
bigtime_t now = system_time();
|
bigtime_t now = system_time();
|
||||||
int32 count = fList.CountItems();
|
for (int32 index = 0; index < fList.CountItems();) {
|
||||||
for (int32 index = 0; index < count;) {
|
|
||||||
PendingNodeMonitorEntry *item = fList.ItemAt(index);
|
PendingNodeMonitorEntry *item = fList.ItemAt(index);
|
||||||
if (item->TooOld(now)) {
|
if (item->TooOld(now)) {
|
||||||
PRINT(("removing old entry from pending node monitor cache\n"));
|
PRINT(("removing old entry from pending node monitor cache\n"));
|
||||||
delete fList.RemoveItemAt(index);
|
delete fList.RemoveItemAt(index);
|
||||||
count--;
|
|
||||||
} else if (item->Match(pose->TargetModel()->NodeRef())) {
|
} else if (item->Match(pose->TargetModel()->NodeRef())) {
|
||||||
|
fList.RemoveItemAt(index);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
PRINT(("reapplying node monitor for model:\n"));
|
PRINT(("reapplying node monitor for model:\n"));
|
||||||
pose->TargetModel()->PrintToStream();
|
pose->TargetModel()->PrintToStream();
|
||||||
@@ -132,8 +131,7 @@ PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView *poseView, const BPose *po
|
|||||||
#endif
|
#endif
|
||||||
poseView->FSNotification(item->NodeMonitor());
|
poseView->FSNotification(item->NodeMonitor());
|
||||||
ASSERT(result);
|
ASSERT(result);
|
||||||
delete fList.RemoveItemAt(index);
|
delete item;
|
||||||
count--;
|
|
||||||
} else
|
} else
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user