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.
(cherry picked from commit fef0bfcfd3
)
This commit is contained in:

committed by
Jonathan G Rennison

parent
a7c2f489f6
commit
4bf9c123d3
@@ -30,8 +30,6 @@ struct TextfileWindow : public Window, MissingGlyphSearcher {
|
||||
Scrollbar *vscroll; ///< Vertical scrollbar.
|
||||
Scrollbar *hscroll; ///< Horizontal scrollbar.
|
||||
|
||||
TextfileWindow(TextfileType file_type);
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override;
|
||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override;
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override;
|
||||
@@ -54,6 +52,9 @@ struct TextfileWindow : public Window, MissingGlyphSearcher {
|
||||
}
|
||||
|
||||
protected:
|
||||
TextfileWindow(TextfileType file_type);
|
||||
void ConstructWindow();
|
||||
|
||||
struct Line {
|
||||
int top{0}; ///< Top scroll position in visual lines.
|
||||
int bottom{0}; ///< Bottom scroll position in visual lines.
|
||||
|
Reference in New Issue
Block a user