For the last few days, some of the widgets appear and disappear randomly after minor modifications of the source, and I could not figure out the reason.
After wasting many hours I finally noticed that some save() and restore() functions do not match.
cr->save(); // some code cr->restore(); cr->save(); // some code cr->save(); // some code cr->restore();
Maybe this style could be better to detect the unmatch manually.
/* frequency display box */ { cr->save(); cr->set_source_rgba(0.5+0.2*sin(phase), 0.5+0.2*cos(phase), 0.5, 1.0); cr->rectangle(5, 5, 390, 50); cr->fill(); cr->stroke(); cr->restore(); }
See that the every block starts with save() and ends with restore().
egrep '(cr->save()|cr->restore())' *.cpp MyDrawingArea2.cpp: cr->save(); MyDrawingArea2.cpp: cr->restore(); MyDrawingArea2.cpp: cr->save(); MyDrawingArea2.cpp: cr->restore(); MyDrawingArea.cpp: cr->save(); MyDrawingArea.cpp: cr->restore(); MyDrawingArea.cpp: cr->save(); MyDrawingArea.cpp: cr->restore(); MyDrawingArea.cpp: cr->save(); MyDrawingArea.cpp: cr->restore(); MyDrawingArea.cpp: cr->save(); MyDrawingArea.cpp: cr->restore(); MyDrawingArea.cpp: cr->save(); MyDrawingArea.cpp: cr->restore();
Now, it seems OK.