end_rebuild needs to be called even if an exception is thrown during
rebuilding.
class PartCache
{
public:
+ class Rebuild
+ {
+ private:
+ PartCache &cache;
+
+ public:
+ Rebuild(PartCache &c): cache(c) { cache.begin_rebuild(); }
+ ~Rebuild() { cache.end_rebuild(); }
+ };
+
typedef std::list<CachedPart> PartList;
private:
if(!style)
return;
- part_cache.begin_rebuild();
+ PartCache::Rebuild rebuild_cache(part_cache);
const Style::PartSeq &parts = style->get_parts();
for(Style::PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i)
{
else
rebuild_special(*i);
}
- part_cache.end_rebuild();
}
void Widget::rebuild_special(const Part &part)