From 1a8ebd0981d1250a30db1bb87cdad07cfec150c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Wed, 4 Oct 2023 19:31:58 +0200 Subject: [PATCH] Fix occasional crashes upon opening settings By zero-initializing pointers in OptionsView so they don't crash when they don't get initialized, which up until very recently they always had. In the cases of the emscripten and android ports, certain components are never created. --- src/gui/options/OptionsView.h | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/gui/options/OptionsView.h b/src/gui/options/OptionsView.h index 8272ed3d8..d598140e4 100644 --- a/src/gui/options/OptionsView.h +++ b/src/gui/options/OptionsView.h @@ -15,31 +15,31 @@ class OptionsModel; class OptionsController; class OptionsView: public ui::Window { - OptionsController * c; - ui::Checkbox * heatSimulation; - ui::Checkbox * ambientHeatSimulation; - ui::Checkbox * newtonianGravity; - ui::Checkbox * waterEqualisation; - ui::DropDown * airMode; - ui::Textbox * ambientAirTemp; - ui::Button * ambientAirTempPreview; - ui::DropDown * gravityMode; - ui::DropDown * edgeMode; - ui::DropDown * temperatureScale; - ui::DropDown * scale; - ui::Checkbox * resizable; - ui::Checkbox * fullscreen; - ui::Checkbox * changeResolution; - ui::Checkbox * forceIntegerScaling; - ui::Checkbox * fastquit = nullptr; - ui::DropDown * decoSpace; - ui::Checkbox * showAvatars; - ui::Checkbox * momentumScroll; - ui::Checkbox * mouseClickRequired; - ui::Checkbox * includePressure; - ui::Checkbox * perfectCircle; - ui::Checkbox * graveExitsConsole; - ui::ScrollPanel * scrollPanel; + OptionsController *c{}; + ui::Checkbox *heatSimulation{}; + ui::Checkbox *ambientHeatSimulation{}; + ui::Checkbox *newtonianGravity{}; + ui::Checkbox *waterEqualisation{}; + ui::DropDown *airMode{}; + ui::Textbox *ambientAirTemp{}; + ui::Button *ambientAirTempPreview{}; + ui::DropDown *gravityMode{}; + ui::DropDown *edgeMode{}; + ui::DropDown *temperatureScale{}; + ui::DropDown *scale{}; + ui::Checkbox *resizable{}; + ui::Checkbox *fullscreen{}; + ui::Checkbox *changeResolution{}; + ui::Checkbox *forceIntegerScaling{}; + ui::Checkbox *fastquit{}; + ui::DropDown *decoSpace{}; + ui::Checkbox *showAvatars{}; + ui::Checkbox *momentumScroll{}; + ui::Checkbox *mouseClickRequired{}; + ui::Checkbox *includePressure{}; + ui::Checkbox *perfectCircle{}; + ui::Checkbox *graveExitsConsole{}; + ui::ScrollPanel *scrollPanel{}; float customGravityX, customGravityY; void UpdateAmbientAirTempPreview(float airTemp, bool isValid); void AmbientAirTempToTextBox(float airTemp);