Prevent crash when trying to draw non-existent 'button_state' button on

an 'FL_NORMAL_COMBOX' combox.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8805 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-06-04 13:20:26 +00:00
parent bd668b25be
commit 07ccd91ec0
2 changed files with 18 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2004-06-04 Angus Leeming <leeming@lyx.org>
* combox.c (combox_handle): prevent crash when trying to draw
non-existent 'button_state' button on an 'FL_NORMAL_COMBOX' combox.
2004-06-02 Lars Gullik Bjønnes <larsbj@lyx.org> 2004-06-02 Lars Gullik Bjønnes <larsbj@lyx.org>
* forms/Makefile.am (.fd.C): Use '-r' to test for file existence, * forms/Makefile.am (.fd.C): Use '-r' to test for file existence,

View File

@ -377,17 +377,23 @@ combox_handle(FL_OBJECT * ob, int event, FL_Coord mx, FL_Coord my, int key,
case FL_DRAWLABEL: { case FL_DRAWLABEL: {
COMBOX_SPEC * sp = ob->spec; COMBOX_SPEC * sp = ob->spec;
FL_Coord const xbs = int change =
ob->x + (sp->button_state->x - sp->button_chosen->x); ob->x != sp->button_chosen->x ||
ob->y != sp->button_chosen->y;
if (ob->x != sp->button_chosen->x || FL_Coord xbs = 0;
ob->y != sp->button_chosen->y || if (sp->button_state) {
xbs != sp->button_state->x || xbs = ob->x + (sp->button_state->x - sp->button_chosen->x);
ob->y != sp->button_state->y) { change = change ||
xbs != sp->button_state->x ||
ob->y != sp->button_state->y;
}
if (change) {
fl_freeze_form(ob->form); fl_freeze_form(ob->form);
fl_set_object_position(sp->button_chosen, ob->x, ob->y); fl_set_object_position(sp->button_chosen, ob->x, ob->y);
fl_set_object_position(sp->button_state, xbs, ob->y); if (sp->button_state)
fl_set_object_position(sp->button_state, xbs, ob->y);
fl_unfreeze_form(ob->form); fl_unfreeze_form(ob->form);
} }