From 005fed9782f914f0d8278f0f3c456a90758fca20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dariusz=20Knoci=C5=84ski?= <dknoto@gmail.com>
Date: Thu, 27 Mar 2014 20:51:03 +0100
Subject: [PATCH] Preferences/VirtualMemory: fixed crash when exiting from not
fully initialized application.
---
src/preferences/virtualmemory/SettingsWindow.cpp | 17 ++++++++++++++---
src/preferences/virtualmemory/SettingsWindow.h | 1 +
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/preferences/virtualmemory/SettingsWindow.cpp b/src/preferences/virtualmemory/SettingsWindow.cpp
index 508cf46..d87122a 100644
a
|
b
|
SettingsWindow::SettingsWindow()
|
120 | 120 | : |
121 | 121 | BWindow(BRect(0, 0, 269, 172), B_TRANSLATE_SYSTEM_NAME("VirtualMemory"), |
122 | 122 | B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS |
123 | | | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) |
124 | | |
| 123 | | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), |
| 124 | fSwapEnabledCheckBox(NULL), |
| 125 | fSwapAutomaticCheckBox(NULL), |
| 126 | fSizeSlider(NULL), |
| 127 | fDefaultsButton(NULL), |
| 128 | fRevertButton(NULL), |
| 129 | fWarningStringView(NULL), |
| 130 | fVolumeMenuField(NULL), |
| 131 | fSwapUsageBar(NULL), |
| 132 | fSetupComplete(false) |
125 | 133 | { |
126 | 134 | gBootDev = dev_for_path("/boot"); |
127 | 135 | BAlignment align(B_ALIGN_LEFT, B_ALIGN_MIDDLE); |
… |
… |
SettingsWindow::SettingsWindow()
|
252 | 260 | |
253 | 261 | // TODO: We may want to run this at an interval |
254 | 262 | _UpdateSwapInfo(); |
| 263 | fSetupComplete = true; |
255 | 264 | } |
256 | 265 | |
257 | 266 | |
… |
… |
SettingsWindow::MessageReceived(BMessage* message)
|
341 | 350 | bool |
342 | 351 | SettingsWindow::QuitRequested() |
343 | 352 | { |
344 | | fSettings.SetWindowPosition(Frame().LeftTop()); |
| 353 | if (!fSetupComplete) |
| 354 | return true; |
345 | 355 | |
| 356 | fSettings.SetWindowPosition(Frame().LeftTop()); |
346 | 357 | _RecordChoices(); |
347 | 358 | fSettings.WriteWindowSettings(); |
348 | 359 | fSettings.WriteSwapSettings(); |
diff --git a/src/preferences/virtualmemory/SettingsWindow.h b/src/preferences/virtualmemory/SettingsWindow.h
index d5df854..437876e 100644
a
|
b
|
private:
|
83 | 83 | BMenuField* fVolumeMenuField; |
84 | 84 | BStatusBar* fSwapUsageBar; |
85 | 85 | Settings fSettings; |
| 86 | bool fSetupComplete; |
86 | 87 | }; |
87 | 88 | |
88 | 89 | #endif /* SETTINGS_WINDOW_H */ |