- Ensure that team and inspector window are locked when save/restoring settings.

- Don't allow QuitRequested() to terminate the TeamWindow directly. GraphicalUserInterface
  will (and must) do so in order to ensure that the window object is still around
  when calling SaveSettings() on it.

Should resolve #8091.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43206 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-11-07 01:47:20 +00:00
parent 8abe72fb66
commit 58f5b04b3b
2 changed files with 21 additions and 3 deletions
@@ -9,7 +9,7 @@
#include <Alert.h>
#include <Application.h>
#include <Autolock.h>
#include <AutoLocker.h>
#include <Button.h>
#include <ControlLook.h>
#include <LayoutBuilder.h>
@@ -277,7 +277,7 @@ InspectorWindow::QuitRequested()
void
InspectorWindow::MemoryBlockRetrieved(TeamMemoryBlock* block)
{
BAutolock lock(this);
AutoLocker<BLooper> lock(this);
if (lock.IsLocked()) {
fCurrentBlock = block;
fMemoryView->SetTargetAddress(block, fCurrentAddress);
@@ -290,6 +290,10 @@ InspectorWindow::MemoryBlockRetrieved(TeamMemoryBlock* block)
status_t
InspectorWindow::LoadSettings(const GUITeamUISettings* settings)
{
AutoLocker<BLooper> lock(this);
if (!lock.IsLocked())
return B_ERROR;
BVariant value;
if (settings->Value("inspectorWindowFrame", value) == B_OK) {
BRect frameRect = value.ToRect();
@@ -308,6 +312,10 @@ InspectorWindow::LoadSettings(const GUITeamUISettings* settings)
status_t
InspectorWindow::SaveSettings(BMessage* settings)
{
AutoLocker<BLooper> lock(this);
if (!lock.IsLocked())
return B_ERROR;
status_t error = settings->AddRect("inspectorWindowFrame", Frame());
if (error != B_OK)
return error;
@@ -335,13 +335,19 @@ TeamWindow::MessageReceived(BMessage* message)
bool
TeamWindow::QuitRequested()
{
return fListener->UserInterfaceQuitRequested();
fListener->UserInterfaceQuitRequested();
return false;
}
status_t
TeamWindow::LoadSettings(const GUITeamUISettings* settings)
{
AutoLocker<BWindow> lock(this);
if (!lock.IsLocked())
return B_ERROR;
BVariant value;
status_t error = settings->Value("teamWindowFrame", value);
if (error == B_OK) {
@@ -364,6 +370,10 @@ TeamWindow::LoadSettings(const GUITeamUISettings* settings)
status_t
TeamWindow::SaveSettings(GUITeamUISettings* settings)
{
AutoLocker<BWindow> lock(this);
if (!lock.IsLocked())
return B_ERROR;
// save the settings from the cached copy first,
// then overwrite them with our most current set
// this is necessary in order to preserve the settings