]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/widget.cpp
Use RAII to ensure consistent PartCache state
[libs/gltk.git] / source / widget.cpp
index b40aa75214f2855def232ebbd48a6f85b7b3fb66..246c8c196ced2222237a9f10af93a71fcb114160 100644 (file)
@@ -207,7 +207,7 @@ void Widget::rebuild()
        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)
        {
@@ -216,7 +216,6 @@ void Widget::rebuild()
                else
                        rebuild_special(*i);
        }
-       part_cache.end_rebuild();
 }
 
 void Widget::rebuild_special(const Part &part)