From 27f365eaa34a8f4b7602a77e65c17ab959ba1a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Mon, 21 Feb 2011 04:02:50 +0000 Subject: [PATCH] Small fix. Helps when doing a Close All from Deskbar and the Terminals all flatten/unflatten all over each other. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40591 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TermWindow.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 9d085c8e57..6366cf3b28 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -548,19 +548,20 @@ TermWindow::_SaveWindowPosition() BFile file; BMessage originalSettings; - // We append ourself to the existing settings file - // So we have to read it, insert our BMessage, and rewrite it. - + // Read the settings file if it exists and is a valid BMessage. status_t status = _GetWindowPositionFile(&file, B_READ_ONLY); if (status == B_OK) { - originalSettings.Unflatten(&file); - // No error checking on that : it fails if the settings - // file is missing, but we can create it. - + status = originalSettings.Unflatten(&file); file.Unset(); + + if (status != B_OK) + status = originalSettings.MakeEmpty(); + + if (status != B_OK) + return status; } - // Append the new settings + // Replace the settings int32 id = fTerminalRoster.ID(); BRect rect(Frame()); if (originalSettings.ReplaceRect("rect", id, rect) != B_OK)