Workaround for dynamically sized labels crashing sometimes when the text size is changed.

A real fix requires more work on the redraw handler.
ugfx_release_2.6
inmarket 2015-04-29 22:43:47 +10:00
parent 54d4f3d95b
commit 83c0eb3526
1 changed files with 11 additions and 3 deletions

View File

@ -145,9 +145,17 @@ static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) {
c = (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text;
if (gw->g.width != w || gw->g.height != h) {
gwinResize(&gw->g, w, h);
return;
/* Only allow the widget to be resize if it will grow larger.
* Growing smaller is problematic because it requires a temporary change in visibility.
* This is a work-around for a crashing bug caused by calling gwinResize() in the draw function
* (dubious) as it may try to reclaim the drawing lock.
*/
if (gw->g.width < w || gw->g.height < h) {
gwinResize(&gw->g, (w > gw->g.width ? w : gw->g.width), (h > gw->g.height ? h : gw->g.height));
return;
}
w = gw->g.width;
h = gw->g.height;
}
#if GWIN_LABEL_ATTRIBUTE