Fix: TextfileWindow called virtual methods before constructor completed. (#11889)
SetStringParameters() was called during widget tree init in the constructor. Calls within a constructor cannot call the derived classes methods. This would result in invalid data being passed to the string system, which could then crash.
This commit is contained in:
@@ -560,6 +560,8 @@ struct NewGRFTextfileWindow : public TextfileWindow {
|
||||
|
||||
NewGRFTextfileWindow(TextfileType file_type, const GRFConfig *c) : TextfileWindow(file_type), grf_config(c)
|
||||
{
|
||||
this->ConstructWindow();
|
||||
|
||||
auto textfile = this->grf_config->GetTextfile(file_type);
|
||||
this->LoadTextfile(textfile.value(), NEWGRF_DIR);
|
||||
}
|
||||
|
Reference in New Issue
Block a user