Changeset 174be87 in mainline for uspace/lib/ui/src/pbutton.c


Ignore:
Timestamp:
2022-05-24T14:48:00Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5877de74
Parents:
0415776
git-author:
Jiri Svoboda <jiri@…> (2022-05-23 17:47:45)
git-committer:
Jiri Svoboda <jiri@…> (2022-05-24 14:48:00)
Message:

Prevent using button after free

When a button is released (after being pressed), it generates two
callbacks, 'clicked' and 'up'. If the handler of the former
closes/destroys the dialog, the second event is delivered to an
already destroyed/freed dialog.

By delivering 'up' first and 'clicked' second, we can prevent this
particular problem. Is it the right solution? Not sure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/pbutton.c

    r0415776 r174be87  
    480480
    481481        pbutton->held = false;
     482        ui_pbutton_up(pbutton);
    482483
    483484        if (pbutton->inside) {
     
    485486                ui_pbutton_clicked(pbutton);
    486487        }
    487 
    488         ui_pbutton_up(pbutton);
    489488}
    490489
Note: See TracChangeset for help on using the changeset viewer.