diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-04-29 22:43:47 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-04-29 22:43:47 +1000 |
commit | 83c0eb35261704499bad756049c158133f7486eb (patch) | |
tree | 433f64a2e0122a1fd97a6608fcba9236fdf7ce04 /src | |
parent | 54d4f3d95bb1a8f740608e83cfad58f6b7fc18c0 (diff) | |
download | uGFX-83c0eb35261704499bad756049c158133f7486eb.tar.gz uGFX-83c0eb35261704499bad756049c158133f7486eb.tar.bz2 uGFX-83c0eb35261704499bad756049c158133f7486eb.zip |
Workaround for dynamically sized labels crashing sometimes when the text size is changed.
A real fix requires more work on the redraw handler.
Diffstat (limited to 'src')
-rw-r--r-- | src/gwin/gwin_label.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gwin/gwin_label.c b/src/gwin/gwin_label.c index 3be9d0a9..a29a9ebc 100644 --- a/src/gwin/gwin_label.c +++ b/src/gwin/gwin_label.c @@ -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 |