#12271: Printing crashes application in
BPrivate::PrintServerMessenger::RejectUserInput()
----------------------+----------------------------
Reporter: diver | Owner: axeld
Type: bug | Status: closed
Priority: normal | Milestone: Unscheduled
Component: Kits | Version: R1/Development
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
----------------------+----------------------------
Comment (by jessicah):
With the changes to BAlert, wouldn't it be simpler (and less API breakage)
to move the call to `SetDefaultButton(ButtonAt(CountButtons() - 1))`
inside `BAlert::_Prepare()` into the new `BAlert::AddButton()` function?
E.g.
{{{
void
BAlert::AddButton(const char* label, char key)
{
...
SetDefaultButton(button);
fButtonLayout->AddView(button);
}
}}}
Given that the API documentation states that the last button is, by
convention, the default button, and this always creates a new last button,
it will automatically set up the default button correctly, as
`AddButton()` is called from `_Init()` and the existing non-default
constructors.
This would remove the hack introduced in hrev49596 for the default button,
and avoid possible crashes in other uses of the originally documented
BAlert API.
--
Ticket URL: <https://dev.haiku-os.org/ticket/12271#comment:10>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.