From b7b0ea9e7ce301cbb38203313cf8da56ce71f0ca Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sun, 1 Jan 2006 22:26:32 +0000 Subject: Fix crash in Login with empty name. --- src/gui/login.cpp | 13 +------------ src/gui/login.h | 5 ++--- 2 files changed, 3 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gui/login.cpp b/src/gui/login.cpp index ad469d22..722911ca 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -61,7 +61,6 @@ WrongDataNoticeListener::action(const std::string &eventId) target->setText(""); target->setCaretPosition(0); target->requestFocus(); - //wrongLoginNotice = NULL; } } @@ -143,15 +142,10 @@ LoginDialog::LoginDialog(): serverField->setText(config.getValue("host", "")); wrongDataNoticeListener = NULL; - wrongLoginNotice = NULL; } LoginDialog::~LoginDialog() { - if (wrongLoginNotice) - { - delete wrongLoginNotice; - } } void @@ -180,12 +174,7 @@ LoginDialog::action(const std::string& eventId) { wrongDataNoticeListener = new WrongDataNoticeListener(); wrongDataNoticeListener->setTarget(this->passField); - if (wrongLoginNotice) - { - delete wrongLoginNotice; - } - wrongLoginNotice = new OkDialog("Error", - "Enter your username first", + new OkDialog("Error", "Enter your username first", wrongDataNoticeListener); } else diff --git a/src/gui/login.h b/src/gui/login.h index ca50df96..52ec27b1 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -90,12 +90,11 @@ class LoginDialog : public Window, public gcn::ActionListener { gcn::Button *registerButton; int mStatus; bool registration; - + void attemptLogin(const std::string& user, const std::string& pass); void checkLogin(); - + WrongDataNoticeListener *wrongDataNoticeListener; - OkDialog *wrongLoginNotice; }; /** -- cgit v1.2.3-70-g09d2