summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-19 22:02:57 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-19 22:02:57 +0000
commit5009d3f68558fc414378edbbef00c552b8deb8e9 (patch)
tree57d95b9670602755853b637b72e6c77d30f75c58
parent0f55757c602c7fec723f73e5820ec936d24cd826 (diff)
downloadmana-5009d3f68558fc414378edbbef00c552b8deb8e9.tar.gz
mana-5009d3f68558fc414378edbbef00c552b8deb8e9.tar.bz2
mana-5009d3f68558fc414378edbbef00c552b8deb8e9.tar.xz
mana-5009d3f68558fc414378edbbef00c552b8deb8e9.zip
Fixed a memory leak and removed some whitespace noise.
-rw-r--r--ChangeLog2
-rw-r--r--src/gui/register.cpp30
-rw-r--r--src/gui/register.h5
3 files changed, 24 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 7bf2662e..c1c0562a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2006-03-19 Björn Steinbrink <B.Steinbrink@gmx.de>
+ * src/gui/register.h, src/gui/register.cpp: Fixed a memory leak and
+ removed some whitespace noise.
* src/lockedarray.h, src/game.cpp, src/gui/gui.cpp,
src/gui/browserbox.cpp, src/gui/register.cpp,
src/resources/resourcemanager.cpp: Removed some useless null pointer
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index c9b9daa7..41d2db6c 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -42,7 +42,10 @@
#include "ok_dialog.h"
RegisterDialog::RegisterDialog(LoginData *loginData):
- Window("Register"), mLoginData(loginData)
+ Window("Register"),
+ mWrongDataNoticeListener(new WrongDataNoticeListener()),
+ mWrongRegisterNotice(0),
+ mLoginData(loginData)
{
gcn::Label *userLabel = new gcn::Label("Name:");
gcn::Label *passwordLabel = new gcn::Label("Password:");
@@ -58,11 +61,11 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mFemaleButton->setEnabled(false);
mRegisterButton = new Button("Register", "register", this);
mCancelButton = new Button("Cancel", "cancel", this);
-
+
int width = 200;
int height = 150;
setContentSize(width, height);
-
+
mUserField->setPosition(65, 5);
mUserField->setWidth(130);
mPasswordField->setPosition(
@@ -79,15 +82,15 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
passwordLabel->setPosition(5, mPasswordField->getY() + 1);
confirmLabel->setPosition(5, mConfirmField->getY() + 1);
serverLabel->setPosition(5, mServerField->getY() + 1);
-
+
mFemaleButton->setPosition(width - mFemaleButton->getWidth() - 10,
- mConfirmField->getY() + mConfirmField->getHeight() + 7);
+ mConfirmField->getY() + mConfirmField->getHeight() + 7);
mMaleButton->setPosition(mFemaleButton->getX() - mMaleButton->getWidth() - 5,
- mFemaleButton->getY());
-
+ mFemaleButton->getY());
+
mRegisterButton->setPosition(5, height - mRegisterButton->getHeight() - 5);
mCancelButton->setPosition(10 + mRegisterButton->getWidth(),
- mRegisterButton->getY());
+ mRegisterButton->getY());
/*mUserField->setEventId("register");
@@ -118,9 +121,11 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mUserField->setCaretPosition(mUserField->getText().length());
mServerField->setText(config.getValue("host", ""));
-
- mWrongDataNoticeListener = NULL;
- mWrongRegisterNotice = NULL;
+}
+
+RegisterDialog::~RegisterDialog()
+{
+ delete mWrongRegisterNotice;
}
void
@@ -183,10 +188,9 @@ RegisterDialog::action(const std::string& eventId)
errorMsg << "Passwords do not match.";
error = 2;
}
-
+
if (error > 0)
{
- mWrongDataNoticeListener = new WrongDataNoticeListener();
if (error == 1)
{
mWrongDataNoticeListener->setTarget(this->mUserField);
diff --git a/src/gui/register.h b/src/gui/register.h
index 305661f3..b46eb1ce 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -49,6 +49,11 @@ class RegisterDialog : public Window, public gcn::ActionListener {
RegisterDialog(LoginData *loginData);
/**
+ * Destructor
+ */
+ ~RegisterDialog();
+
+ /**
* Called when receiving actions from the widgets.
*/
void action(const std::string& eventId);