Ticket #10720: 0001-Preferences-VirtualMemory-fixed-crash-when-exiting-f.patch

File 0001-Preferences-VirtualMemory-fixed-crash-when-exiting-f.patch, 2.2 KB (added by dknoto, 10 years ago)
  • src/preferences/virtualmemory/SettingsWindow.cpp

    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()  
    120120    :
    121121    BWindow(BRect(0, 0, 269, 172), B_TRANSLATE_SYSTEM_NAME("VirtualMemory"),
    122122        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)
    125133{
    126134    gBootDev = dev_for_path("/boot");
    127135    BAlignment align(B_ALIGN_LEFT, B_ALIGN_MIDDLE);
    SettingsWindow::SettingsWindow()  
    252260
    253261    // TODO: We may want to run this at an interval
    254262    _UpdateSwapInfo();
     263    fSetupComplete = true;
    255264}
    256265
    257266
    SettingsWindow::MessageReceived(BMessage* message)  
    341350bool
    342351SettingsWindow::QuitRequested()
    343352{
    344     fSettings.SetWindowPosition(Frame().LeftTop());
     353    if (!fSetupComplete)
     354        return true;
    345355
     356    fSettings.SetWindowPosition(Frame().LeftTop());
    346357    _RecordChoices();
    347358    fSettings.WriteWindowSettings();
    348359    fSettings.WriteSwapSettings();
  • src/preferences/virtualmemory/SettingsWindow.h

    diff --git a/src/preferences/virtualmemory/SettingsWindow.h b/src/preferences/virtualmemory/SettingsWindow.h
    index d5df854..437876e 100644
    a b private:  
    8383            BMenuField*     fVolumeMenuField;
    8484            BStatusBar*     fSwapUsageBar;
    8585            Settings        fSettings;
     86            bool            fSetupComplete;
    8687};
    8788
    8889#endif  /* SETTINGS_WINDOW_H */