Workaround for dynamically sized labels crashing sometimes when the text size is changed.
A real fix requires more work on the redraw handler.
This commit is contained in:
parent
54d4f3d95b
commit
83c0eb3526
1 changed files with 11 additions and 3 deletions
|
@ -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;
|
c = (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text;
|
||||||
|
|
||||||
if (gw->g.width != w || gw->g.height != h) {
|
if (gw->g.width != w || gw->g.height != h) {
|
||||||
gwinResize(&gw->g, w, h);
|
/* Only allow the widget to be resize if it will grow larger.
|
||||||
|
* Growing smaller is problematic because it requires a temporary change in visibility.
|
||||||
return;
|
* 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
|
#if GWIN_LABEL_ATTRIBUTE
|
||||||
|
|
Loading…
Add table
Reference in a new issue