From 1df0f995cbcafa24a9312c25aa7c24fe910ed54c Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 6 Aug 2008 19:43:58 +0000 Subject: Make sure only to save the window state when a window name is set, and fail when loadWindowState() is called without setting a window name. --- src/gui/window.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 1c5072f5..ee8aca64 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -135,14 +136,15 @@ Window::~Window() const std::string &name = mWindowName; // Saving X, Y and Width and Height for resizables in the config - config.setValue(name + "WinX", getX()); - config.setValue(name + "WinY", getY()); - config.setValue(name + "Visible", isVisible()); - - if (mGrip) - { - config.setValue(name + "WinWidth", getWidth()); - config.setValue(name + "WinHeight", getHeight()); + if (!name.empty()) { + config.setValue(name + "WinX", getX()); + config.setValue(name + "WinY", getY()); + config.setValue(name + "Visible", isVisible()); + + if (mGrip) { + config.setValue(name + "WinWidth", getWidth()); + config.setValue(name + "WinHeight", getHeight()); + } } instances--; @@ -474,6 +476,7 @@ void Window::loadWindowState() { const std::string &name = mWindowName; + assert(!name.empty()); setPosition((int) config.getValue(name + "WinX", mDefaultX), (int) config.getValue(name + "WinY", mDefaultY)); -- cgit v1.2.3-60-g2f50