From 055dab920b331ebbebc2a9145ccdc752f638c62a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Oct 2013 15:24:19 +0300 Subject: move virtual member calls from itemamountwindow constuctor into postInit. --- src/gui/windows/itemamountwindow.cpp | 12 +++++++----- src/gui/windows/itemamountwindow.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 7ad559c92..0c0f0bfe2 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -156,10 +156,8 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, mEnabledKeyboard(keyboard.isEnabled()) { if (!mItem) - { - setVisible(false); return; - } + if (usage == ShopBuyAdd) mMax = 10000; else if (!mMax) @@ -297,11 +295,15 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, } setLocationRelativeTo(getParentWindow()); - setVisible(true); mItemIcon->addMouseListener(this); } +void ItemAmountWindow::postInit() +{ + setVisible(mItem); +} + ItemAmountWindow::~ItemAmountWindow() { delete mItemPopup; @@ -448,5 +450,5 @@ void ItemAmountWindow::showWindow(const Usage usage, Window *const parent, if (usage != ShopBuyAdd && usage != ShopSellAdd && maxRange <= 1) finish(item, maxRange, 0, usage); else - new ItemAmountWindow(usage, parent, item, maxRange); + (new ItemAmountWindow(usage, parent, item, maxRange))->postInit(); } diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h index 2e741a6cd..45d0d6b83 100644 --- a/src/gui/windows/itemamountwindow.h +++ b/src/gui/windows/itemamountwindow.h @@ -60,6 +60,8 @@ class ItemAmountWindow final : public Window, A_DELETE_COPY(ItemAmountWindow) + void postInit(); + /** * Called when receiving actions from widget. */ -- cgit v1.2.3-70-g09d2