summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-04 22:51:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-04 22:51:17 +0300
commitbc4957b24e6939f4e681e9412f9bbdd483a6bc35 (patch)
tree26f151a039a24f294774d32a4e1f89ceaa6ae2af /src
parentfe84fc25906d6cc6801f9e15cf2652e1d16419ca (diff)
downloadplus-bc4957b24e6939f4e681e9412f9bbdd483a6bc35.tar.gz
plus-bc4957b24e6939f4e681e9412f9bbdd483a6bc35.tar.bz2
plus-bc4957b24e6939f4e681e9412f9bbdd483a6bc35.tar.xz
plus-bc4957b24e6939f4e681e9412f9bbdd483a6bc35.zip
Fix removing listeners from window if used guitable as container.
This fixing crash with settings window after reconnect to server.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/button.cpp13
-rw-r--r--src/gui/widgets/button.h2
-rw-r--r--src/gui/widgets/checkbox.cpp13
-rw-r--r--src/gui/widgets/checkbox.h2
-rw-r--r--src/gui/widgets/label.cpp13
-rw-r--r--src/gui/widgets/label.h2
-rw-r--r--src/gui/widgets/radiobutton.cpp13
-rw-r--r--src/gui/widgets/radiobutton.h2
-rw-r--r--src/gui/widgets/textfield.cpp13
-rw-r--r--src/gui/widgets/textfield.h2
10 files changed, 75 insertions, 0 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 73a289630..842286ecb 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -915,3 +915,16 @@ void Button::setParent(Widget *widget)
mWindow->addWidgetListener(this);
Widget::setParent(widget);
}
+
+void Button::setWindow(Widget *const widget)
+{
+ if (!widget && mWindow)
+ {
+ mWindow->removeWidgetListener(this);
+ mWindow = nullptr;
+ }
+ else
+ {
+ Widget2::setWindow(widget);
+ }
+}
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index 5c63c86ce..233906d06 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -251,6 +251,8 @@ class Button final : public Widget,
void setParent(Widget *widget) override final;
+ void setWindow(Widget *const widget) override final;
+
enum
{
BUTTON_STANDARD = 0, // 0
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 20a58bdf1..f7dbf3526 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -322,3 +322,16 @@ void CheckBox::widgetHidden(const Event &event A_UNUSED)
mTextChanged = true;
mTextChunk.deleteImage();
}
+
+void CheckBox::setWindow(Widget *const widget)
+{
+ if (!widget && mWindow)
+ {
+ mWindow->removeWidgetListener(this);
+ mWindow = nullptr;
+ }
+ else
+ {
+ Widget2::setWindow(widget);
+ }
+}
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index 5555046ba..2f2fe812d 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -182,6 +182,8 @@ class CheckBox final : public Widget,
void widgetHidden(const Event &event) override final;
+ void setWindow(Widget *const widget) override final;
+
private:
void toggleSelected();
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index e3ba34d26..722e1bbe9 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -269,6 +269,19 @@ void Label::setParent(Widget *widget)
Widget::setParent(widget);
}
+void Label::setWindow(Widget *const widget)
+{
+ if (!widget && mWindow)
+ {
+ mWindow->removeWidgetListener(this);
+ mWindow = nullptr;
+ }
+ else
+ {
+ Widget2::setWindow(widget);
+ }
+}
+
void Label::widgetHidden(const Event &event A_UNUSED)
{
mTextChanged = true;
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index 29280e17a..bbe49a1e0 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -162,6 +162,8 @@ class Label final : public Widget,
void setParent(Widget *widget) override final;
+ void setWindow(Widget *const widget) override final;
+
void widgetHidden(const Event &event) override final;
static Skin *mSkin;
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index a3c4d1797..781a52421 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -357,3 +357,16 @@ void RadioButton::widgetHidden(const Event &event A_UNUSED)
mTextChanged = true;
mTextChunk.deleteImage();
}
+
+void RadioButton::setWindow(Widget *const widget)
+{
+ if (!widget && mWindow)
+ {
+ mWindow->removeWidgetListener(this);
+ mWindow = nullptr;
+ }
+ else
+ {
+ Widget2::setWindow(widget);
+ }
+}
diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h
index ab586b2d4..f1e4748e1 100644
--- a/src/gui/widgets/radiobutton.h
+++ b/src/gui/widgets/radiobutton.h
@@ -196,6 +196,8 @@ class RadioButton final : public Widget,
void widgetHidden(const Event &event) override final;
+ void setWindow(Widget *const widget) override final;
+
private:
static int instances;
static Skin *mSkin;
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 0d7b3d883..c7b9cd312 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -797,3 +797,16 @@ void TextField::setParent(Widget *widget)
mWindow->addWidgetListener(this);
Widget::setParent(widget);
}
+
+void TextField::setWindow(Widget *const widget)
+{
+ if (!widget && mWindow)
+ {
+ mWindow->removeWidgetListener(this);
+ mWindow = nullptr;
+ }
+ else
+ {
+ Widget2::setWindow(widget);
+ }
+}
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index 79ad3f110..0c5335143 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -231,6 +231,8 @@ class TextField notfinal : public Widget,
void setParent(Widget *widget) override final;
+ void setWindow(Widget *const widget) override final;
+
protected:
void drawCaret(Graphics* graphics, int x);