mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-10 14:59:31 +08:00
Keep views on views_ list so that they can be found again.
This commit is contained in:
@ -331,29 +331,19 @@ File_read::get_lasting_view(off_t start, off_t size, bool cache)
|
|||||||
void
|
void
|
||||||
File_read::clear_views(bool destroying)
|
File_read::clear_views(bool destroying)
|
||||||
{
|
{
|
||||||
for (Views::iterator p = this->views_.begin();
|
Views::iterator p = this->views_.begin();
|
||||||
p != this->views_.end();
|
while (p != this->views_.end())
|
||||||
++p)
|
|
||||||
{
|
{
|
||||||
if (!p->second->is_locked()
|
if (!p->second->is_locked()
|
||||||
&& (destroying || !p->second->should_cache()))
|
&& (destroying || !p->second->should_cache()))
|
||||||
delete p->second;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
gold_assert(!destroying);
|
delete p->second;
|
||||||
this->saved_views_.push_back(p->second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->views_.clear();
|
|
||||||
|
|
||||||
Saved_views::iterator p = this->saved_views_.begin();
|
// map::erase invalidates only the iterator to the deleted
|
||||||
while (p != this->saved_views_.end())
|
// element.
|
||||||
{
|
Views::iterator pe = p;
|
||||||
if (!(*p)->is_locked()
|
++p;
|
||||||
&& (destroying || !(*p)->should_cache()))
|
this->views_.erase(pe);
|
||||||
{
|
|
||||||
delete *p;
|
|
||||||
p = this->saved_views_.erase(p);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -361,6 +351,22 @@ File_read::clear_views(bool destroying)
|
|||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Saved_views::iterator q = this->saved_views_.begin();
|
||||||
|
while (q != this->saved_views_.end())
|
||||||
|
{
|
||||||
|
if (!(*q)->is_locked()
|
||||||
|
&& (destroying || !(*q)->should_cache()))
|
||||||
|
{
|
||||||
|
delete *q;
|
||||||
|
q = this->saved_views_.erase(q);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gold_assert(!destroying);
|
||||||
|
++q;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print statistical information to stderr. This is used for --stats.
|
// Print statistical information to stderr. This is used for --stats.
|
||||||
|
Reference in New Issue
Block a user