Codefix: [UI] Incorrect initialisation order for rail/road toolbars. (#12843)

The toolbar state was set after the widget tree is created, during which toolbar state is needed.
This commit is contained in:
Peter Nelson 2024-07-04 22:04:41 +01:00 committed by GitHub
parent 2dc0a33eb7
commit 4976a0140e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -438,8 +438,9 @@ struct BuildRailToolbarWindow : Window {
BuildRailToolbarWindow(WindowDesc &desc, RailType railtype) : Window(desc) BuildRailToolbarWindow(WindowDesc &desc, RailType railtype) : Window(desc)
{ {
this->InitNested(TRANSPORT_RAIL); this->CreateNestedTree();
this->SetupRailToolbar(railtype); this->SetupRailToolbar(railtype);
this->FinishInitNested(TRANSPORT_RAIL);
this->DisableWidget(WID_RAT_REMOVE); this->DisableWidget(WID_RAT_REMOVE);
this->OnInvalidateData(); this->OnInvalidateData();
this->last_user_action = INVALID_WID_RAT; this->last_user_action = INVALID_WID_RAT;

View File

@ -349,8 +349,9 @@ struct BuildRoadToolbarWindow : Window {
BuildRoadToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc) BuildRoadToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
{ {
this->Initialize(_cur_roadtype); this->Initialize(_cur_roadtype);
this->InitNested(window_number); this->CreateNestedTree();
this->SetupRoadToolbar(); this->SetupRoadToolbar();
this->FinishInitNested(window_number);
this->SetWidgetDisabledState(WID_ROT_REMOVE, true); this->SetWidgetDisabledState(WID_ROT_REMOVE, true);
if (RoadTypeIsRoad(this->roadtype)) { if (RoadTypeIsRoad(this->roadtype)) {