diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-28 00:39:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-28 11:04:23 +0300 |
commit | 0c35dab0ba366f85b40ef1795125521f1df8c264 (patch) | |
tree | dde6abde3288f543ae96a2468b2275af8a03e704 /src/gui/windows | |
parent | 47cc515695fcd0b16467506e4984d2ec38fad4e4 (diff) | |
download | manaverse-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.gz manaverse-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.bz2 manaverse-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.xz manaverse-0c35dab0ba366f85b40ef1795125521f1df8c264.zip |
simplify variables cleanup.
Diffstat (limited to 'src/gui/windows')
29 files changed, 133 insertions, 210 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 86e819121..8bece77ef 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -47,6 +47,7 @@ #include "resources/iteminfo.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include <algorithm> @@ -302,9 +303,7 @@ void BuyDialog::init() BuyDialog::~BuyDialog() { - delete mShopItems; - mShopItems = nullptr; - + delete2(mShopItems); instances.remove(this); } diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp index b8f9c1fd2..ce9ec84e8 100644 --- a/src/gui/windows/changeemaildialog.cpp +++ b/src/gui/windows/changeemaildialog.cpp @@ -35,6 +35,7 @@ #include "net/loginhandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include <string> @@ -105,8 +106,7 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData *const data): ChangeEmailDialog::~ChangeEmailDialog() { - delete mWrongDataNoticeListener; - mWrongDataNoticeListener = nullptr; + delete2(mWrongDataNoticeListener); } void ChangeEmailDialog::action(const ActionEvent &event) diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp index 05c7a9309..051fa6434 100644 --- a/src/gui/windows/changepassworddialog.cpp +++ b/src/gui/windows/changepassworddialog.cpp @@ -36,6 +36,7 @@ #include "net/loginhandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include <string> @@ -84,8 +85,7 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *const data): ChangePasswordDialog::~ChangePasswordDialog() { - delete mWrongDataNoticeListener; - mWrongDataNoticeListener = nullptr; + delete2(mWrongDataNoticeListener); } void ChangePasswordDialog::action(const ActionEvent &event) diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 53b4b55ff..cf69af099 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -45,6 +45,7 @@ #include "resources/db/chardb.h" #include "resources/db/itemdb.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -313,8 +314,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, CharCreateDialog::~CharCreateDialog() { - delete mPlayer; - mPlayer = nullptr; + delete2(mPlayer); if (Net::getCharServerHandler()) Net::getCharServerHandler()->setCharCreateDialog(nullptr); @@ -491,14 +491,11 @@ void CharCreateDialog::setAttributes(const StringVect &labels, for (unsigned i = 0; i < mAttributeLabel.size(); i++) { remove(mAttributeLabel[i]); - delete mAttributeLabel[i]; - mAttributeLabel[i] = nullptr; + delete2(mAttributeLabel[i]) remove(mAttributeSlider[i]); - delete mAttributeSlider[i]; - mAttributeSlider[i] = nullptr; + delete2(mAttributeSlider[i]) remove(mAttributeValue[i]); - delete mAttributeValue[i]; - mAttributeValue[i] = nullptr; + delete2(mAttributeValue[i]) } mAttributeLabel.resize(labels.size()); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 0a5480520..51ca414a7 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -67,6 +67,7 @@ #include "net/net.h" #include "utils/copynpaste.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "resources/resourcemanager.h" @@ -266,12 +267,9 @@ ChatWindow::~ChatWindow() saveState(); config.setValue("ReturnToggles", mReturnToggles); removeAllWhispers(); - delete mItemLinkHandler; - mItemLinkHandler = nullptr; - delete mColorPicker; - mColorPicker = nullptr; - delete mColorListModel; - mColorListModel = nullptr; + delete2(mItemLinkHandler); + delete2(mColorPicker); + delete2(mColorListModel); } void ChatWindow::postInit() @@ -646,8 +644,7 @@ void ChatWindow::ignoreAllWhispers() PlayerRelation::IGNORED); } - delete (iter->second); - iter->second = nullptr; + delete2 (iter->second) } } diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index 50dc5dbe5..438103f0a 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -42,6 +42,7 @@ #include "net/packetcounters.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/stringutils.h" #include "utils/timer.h" @@ -88,12 +89,9 @@ DebugWindow::DebugWindow() : DebugWindow::~DebugWindow() { - delete mMapWidget; - mMapWidget = nullptr; - delete mTargetWidget; - mTargetWidget = nullptr; - delete mNetWidget; - mNetWidget = nullptr; + delete2(mMapWidget); + delete2(mTargetWidget); + delete2(mNetWidget); } void DebugWindow::postInit() diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp index 3a7141533..0f286b145 100644 --- a/src/gui/windows/emotewindow.cpp +++ b/src/gui/windows/emotewindow.cpp @@ -28,6 +28,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/tabbedarea.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "resources/image.h" @@ -121,20 +122,13 @@ EmoteWindow::~EmoteWindow() { mTabs->removeAll(false); mTabs->removeTab(mTabs->getTabByIndex(0)); - delete mEmotePage; - mEmotePage = nullptr; - delete mColorPage; - mColorPage = nullptr; - delete mColorModel; - mColorModel = nullptr; - delete mScrollColorPage; - mScrollColorPage = nullptr; - delete mFontPage; - mFontPage = nullptr; - delete mFontModel; - mFontModel = nullptr; - delete mScrollFontPage; - mScrollFontPage = nullptr; + delete2(mEmotePage); + delete2(mColorPage); + delete2(mColorModel); + delete2(mScrollColorPage); + delete2(mFontPage); + delete2(mFontModel); + delete2(mScrollFontPage); if (mImageSet) { mImageSet->decRef(); diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 47e7e8b7d..4c026281b 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -44,6 +44,7 @@ #include "resources/imageset.h" +#include "utils/delete2.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -132,14 +133,12 @@ void EquipmentWindow::postInit() EquipmentWindow::~EquipmentWindow() { - delete mItemPopup; - mItemPopup = nullptr; + delete2(mItemPopup); if (this == beingEquipmentWindow) { if (mEquipment) delete mEquipment->getBackend(); - delete mEquipment; - mEquipment = nullptr; + delete2(mEquipment) } delete_all(mBoxes); mBoxes.clear(); @@ -152,8 +151,7 @@ EquipmentWindow::~EquipmentWindow() mSlotBackground->decRef(); if (mSlotHighlightedBackground) mSlotHighlightedBackground->decRef(); - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); } void EquipmentWindow::draw(Graphics *graphics) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index b9bdf6ad9..c2a4b4636 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -59,6 +59,8 @@ #include "net/inventoryhandler.h" #include "net/net.h" +#include "utils/delete2.h" + #include <string> #include "debug.h" @@ -274,8 +276,7 @@ InventoryWindow::~InventoryWindow() invInstances.front()->updateDropButton(); mSortDropDown->hideDrop(false); - delete mSortModel; - mSortModel = nullptr; + delete2(mSortModel); mTextPopup = nullptr; } diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 7db944695..472057060 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -48,6 +48,7 @@ #include "gui/widgets/label.h" #include "gui/widgets/slider.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -261,8 +262,7 @@ void ItemAmountWindow::postInit() ItemAmountWindow::~ItemAmountWindow() { - delete mItemPopup; - mItemPopup = nullptr; + delete2(mItemPopup); } // Show ItemTooltip diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 4db58e911..984006204 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -46,6 +46,7 @@ #include "net/loginhandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/paths.h" #include "utils/process.h" @@ -208,10 +209,8 @@ void LoginDialog::postInit() LoginDialog::~LoginDialog() { - delete mUpdateTypeModel; - mUpdateTypeModel = nullptr; - delete mUpdateListModel; - mUpdateListModel = nullptr; + delete2(mUpdateTypeModel); + delete2(mUpdateListModel); } void LoginDialog::action(const ActionEvent &event) diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 583a37746..9be6d7304 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -39,6 +39,7 @@ #include "resources/imagehelper.h" #include "resources/resourcemanager.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/sdlcheckutils.h" @@ -97,8 +98,7 @@ Minimap::~Minimap() mMapImage->decRef(); mMapImage = nullptr; } - delete mTextPopup; - mTextPopup = nullptr; + delete2(mTextPopup); } void Minimap::setMap(const Map *const map) diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index d8f28535f..885ea619b 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -42,6 +42,7 @@ #include "net/playerhandler.h" #include "net/gamehandler.h" +#include "utils/delete2.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -147,10 +148,8 @@ MiniStatusWindow::MiniStatusWindow() : MiniStatusWindow::~MiniStatusWindow() { - delete mTextPopup; - mTextPopup = nullptr; - delete mStatusPopup; - mStatusPopup = nullptr; + delete2(mTextPopup); + delete2(mStatusPopup); delete_all(mIcons); mIcons.clear(); diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 17ff9a8c1..56306a90f 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -57,6 +57,7 @@ #include "net/npchandler.h" #include "utils/copynpaste.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -216,44 +217,23 @@ NpcDialog::~NpcDialog() delete mPlayerBox; } - delete mTextBox; - mTextBox = nullptr; - delete mClearButton; - mClearButton = nullptr; - delete mButton; - mButton = nullptr; - delete mButton2; - mButton2 = nullptr; - delete mButton3; - mButton3 = nullptr; - - // These might not actually be in the layout, so lets be safe - delete mScrollArea; - mScrollArea = nullptr; - delete mItemList; - mItemList = nullptr; - delete mTextField; - mTextField = nullptr; - delete mIntField; - mIntField = nullptr; - delete mResetButton; - mResetButton = nullptr; - delete mPlusButton; - mPlusButton = nullptr; - delete mMinusButton; - mMinusButton = nullptr; - delete mItemLinkHandler; - mItemLinkHandler = nullptr; - - delete mItemContainer; - mItemContainer = nullptr; - delete mInventory; - mInventory = nullptr; - delete mItemScrollArea; - mItemScrollArea = nullptr; - - delete mListScrollArea; - mListScrollArea = nullptr; + delete2(mTextBox); + delete2(mClearButton); + delete2(mButton); + delete2(mButton2); + delete2(mButton3); + delete2(mScrollArea); + delete2(mItemList); + delete2(mTextField); + delete2(mIntField); + delete2(mResetButton); + delete2(mPlusButton); + delete2(mMinusButton); + delete2(mItemLinkHandler); + delete2(mItemContainer); + delete2(mInventory); + delete2(mItemScrollArea); + delete2(mListScrollArea); FOR_EACH (ImageVectorIter, it, mImages) { @@ -896,8 +876,7 @@ void NpcDialog::showAvatar(const uint16_t avatarId) } else { - delete mAvatarBeing; - mAvatarBeing = nullptr; + delete2(mAvatarBeing) mPlayerBox->setPlayer(nullptr); } if (needShow != mShowAvatar) diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 8d4eae9c8..b57ed9bd7 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -38,6 +38,7 @@ #include "gui/widgets/itemlinkhandler.h" #include "gui/widgets/scrollarea.h" +#include "utils/delete2.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -178,8 +179,7 @@ QuestsWindow::QuestsWindow() : QuestsWindow::~QuestsWindow() { - delete mQuestsModel; - mQuestsModel = nullptr; + delete2(mQuestsModel); for (std::map<int, std::vector<QuestItem*> >::iterator it = mQuests.begin(), it_end = mQuests.end(); it != it_end; ++ it) @@ -194,8 +194,7 @@ QuestsWindow::~QuestsWindow() delete_all(mAllEffects); mAllEffects.clear(); - delete mItemLinkHandler; - mItemLinkHandler = nullptr; + delete2(mItemLinkHandler); mQuests.clear(); mQuestLinks.clear(); if (mCompleteIcon) diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index 560968311..5205db1e6 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -42,6 +42,7 @@ #include "net/gamehandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/process.h" @@ -131,14 +132,10 @@ QuitDialog::~QuitDialog() { if (mMyPointer) *mMyPointer = nullptr; - delete mForceQuit; - mForceQuit = nullptr; - delete mLogoutQuit; - mLogoutQuit = nullptr; - delete mSwitchAccountServer; - mSwitchAccountServer = nullptr; - delete mSwitchCharacter; - mSwitchCharacter = nullptr; + delete2(mForceQuit); + delete2(mLogoutQuit); + delete2(mSwitchAccountServer); + delete2(mSwitchCharacter); } void QuitDialog::placeOption(ContainerPlacer &placer, diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index 9c74cbc0d..55a328fa8 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -40,6 +40,7 @@ #include "net/loginhandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -169,8 +170,7 @@ void RegisterDialog::postInit() RegisterDialog::~RegisterDialog() { - delete mWrongDataNoticeListener; - mWrongDataNoticeListener = nullptr; + delete2(mWrongDataNoticeListener); } void RegisterDialog::action(const ActionEvent &event) diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp index ebee65d1e..604caa72e 100644 --- a/src/gui/windows/selldialog.cpp +++ b/src/gui/windows/selldialog.cpp @@ -45,6 +45,7 @@ #include "resources/iteminfo.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -162,8 +163,7 @@ void SellDialog::init() SellDialog::~SellDialog() { - delete mShopItems; - mShopItems = nullptr; + delete2(mShopItems); instances.remove(this); } diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 33b6f1599..9e85f5c89 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -46,6 +46,7 @@ #include "gui/widgets/listbox.h" #include "gui/widgets/scrollarea.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/langs.h" @@ -295,11 +296,9 @@ ServerDialog::~ServerDialog() if (mDownload) { mDownload->cancel(); - delete mDownload; - mDownload = nullptr; + delete2(mDownload) } - delete mServersListModel; - mServersListModel = nullptr; + delete2(mServersListModel); } void ServerDialog::connectToSelectedServer() @@ -517,8 +516,7 @@ void ServerDialog::downloadServerList() if (mDownload) { mDownload->cancel(); - delete mDownload; - mDownload = nullptr; + delete2(mDownload) } mDownload = new Net::Download(this, listFile, diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp index 1760d00bd..7239061ff 100644 --- a/src/gui/windows/setupwindow.cpp +++ b/src/gui/windows/setupwindow.cpp @@ -48,6 +48,7 @@ #include "gui/widgets/label.h" #include "gui/widgets/tabbedarea.h" +#include "utils/delete2.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -223,8 +224,7 @@ void SetupWindow::unloadModTab() mTabs.remove(mModsTab); Tab *const tab = mPanel->getTab(mModsTab->getName()); mPanel->removeTab(tab); - delete mModsTab; - mModsTab = nullptr; + delete2(mModsTab) } } diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 923511baa..b44dcc19e 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -58,6 +58,7 @@ #include "resources/iteminfo.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include <sstream> @@ -197,11 +198,8 @@ ShopWindow::~ShopWindow() { saveList(); - delete mBuyShopItems; - mBuyShopItems = nullptr; - - delete mSellShopItems; - mSellShopItems = nullptr; + delete2(mBuyShopItems); + delete2(mSellShopItems); instances.remove(this); } diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index 6ec442cd5..8387d7e91 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -30,6 +30,8 @@ #include "gui/widgets/shortcutcontainer.h" #include "gui/widgets/tabs/tab.h" +#include "utils/delete2.h" + #include "debug.h" static const int SCROLL_PADDING = 0; @@ -152,10 +154,8 @@ ShortcutWindow::~ShortcutWindow() { if (mTabs) mTabs->removeAll(); - delete mTabs; - mTabs = nullptr; - delete mItems; - mItems = nullptr; + delete2(mTabs); + delete2(mItems); } void ShortcutWindow::addTab(const std::string &name, diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index ebad47b98..f077341bf 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -50,6 +50,7 @@ #include "net/playerhandler.h" #include "net/skillhandler.h" +#include "utils/delete2.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -83,10 +84,8 @@ class SkillListBox final : public ListBox ~SkillListBox() { - delete mModel; - mModel = nullptr; - delete mPopup; - mPopup = nullptr; + delete2(mModel) + delete2(mPopup) } SkillInfo *getSelectedInfo() const @@ -256,8 +255,7 @@ class SkillTab final : public Tab ~SkillTab() { - delete mListBox; - mListBox = nullptr; + delete2(mListBox) } SkillInfo *getSelectedInfo() const diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 520184364..3f6fe663d 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -57,6 +57,7 @@ #include "net/guildhandler.h" #include "net/partyhandler.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -206,10 +207,8 @@ public: ~SocialGuildTab() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; + delete2(mList) + delete2(mScroll) } void action(const ActionEvent &event) override final @@ -342,10 +341,8 @@ public: ~SocialGuildTab2() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; + delete2(mList) + delete2(mScroll) } void action(const ActionEvent &event A_UNUSED) override final @@ -411,10 +408,8 @@ public: ~SocialPartyTab() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; + delete2(mList) + delete2(mScroll) } void action(const ActionEvent &event) override final @@ -530,12 +525,9 @@ public: ~SocialPlayersTab() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; - delete mBeings; - mBeings = nullptr; + delete2(mList) + delete2(mScroll) + delete2(mBeings) } void updateList() override final @@ -697,12 +689,9 @@ public: ~SocialNavigationTab() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; - delete mBeings; - mBeings = nullptr; + delete2(mList) + delete2(mScroll) + delete2(mBeings) } void updateList() override final @@ -1026,12 +1015,9 @@ public: ~SocialAttackTab() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; - delete mBeings; - mBeings = nullptr; + delete2(mList) + delete2(mScroll) + delete2(mBeings) } void updateList() override final @@ -1073,12 +1059,9 @@ public: ~SocialPickupTab() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; - delete mBeings; - mBeings = nullptr; + delete2(mList) + delete2(mScroll) + delete2(mBeings) } void updateList() override final @@ -1120,12 +1103,9 @@ public: ~SocialFriendsTab() { - delete mList; - mList = nullptr; - delete mScroll; - mScroll = nullptr; - delete mBeings; - mBeings = nullptr; + delete2(mList) + delete2(mScroll) + delete2(mBeings) } void updateList() override final @@ -1371,18 +1351,12 @@ SocialWindow::~SocialWindow() mPartyInviter.clear(); } - delete mCreatePopup; - mCreatePopup = nullptr; - delete mPlayers; - mPlayers = nullptr; - delete mNavigation; - mNavigation = nullptr; - delete mAttackFilter; - mAttackFilter = nullptr; - delete mPickupFilter; - mPickupFilter = nullptr; - delete mFriends; - mFriends = nullptr; + delete2(mCreatePopup); + delete2(mPlayers); + delete2(mNavigation); + delete2(mAttackFilter); + delete2(mPickupFilter); + delete2(mFriends); } bool SocialWindow::addTab(Guild *const guild) diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 7fb4496cc..98d3ea82e 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -49,6 +49,7 @@ #include "net/playerhandler.h" #include "net/gamehandler.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include <SDL_timer.h> @@ -791,8 +792,7 @@ AttrDisplay::AttrDisplay(const Widget2 *const widget, AttrDisplay::~AttrDisplay() { - delete mLayout; - mLayout = nullptr; + delete2(mLayout); } std::string AttrDisplay::update() diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index dead469bc..2eccb255d 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -38,6 +38,7 @@ #include "gui/widgets/layout.h" #include "gui/widgets/radiobutton.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -191,12 +192,9 @@ void TextCommandEditor::postInit() TextCommandEditor::~TextCommandEditor() { - delete mIconsModel; - mIconsModel = nullptr; - delete mTargetTypeModel; - mTargetTypeModel = nullptr; - delete mMagicSchoolModel; - mMagicSchoolModel = nullptr; + delete2(mIconsModel); + delete2(mTargetTypeModel); + delete2(mMagicSchoolModel); } void TextCommandEditor::action(const ActionEvent &event) diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp index 3326ca2bb..bb309c6f1 100644 --- a/src/gui/windows/unregisterdialog.cpp +++ b/src/gui/windows/unregisterdialog.cpp @@ -35,6 +35,7 @@ #include "net/loginhandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include <string> @@ -97,8 +98,7 @@ void UnRegisterDialog::postInit() UnRegisterDialog::~UnRegisterDialog() { - delete mWrongDataNoticeListener; - mWrongDataNoticeListener = nullptr; + delete2(mWrongDataNoticeListener); } void UnRegisterDialog::action(const ActionEvent &event) diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 70af8e7ea..cd0e7e0d8 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -42,6 +42,7 @@ #include "resources/db/moddb.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/mkdir.h" #include "utils/paths.h" @@ -242,8 +243,7 @@ UpdaterWindow::~UpdaterWindow() { mDownload->cancel(); - delete mDownload; - mDownload = nullptr; + delete2(mDownload) } free(mMemoryBuffer); } diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index 963da8f22..5cd0a3b2f 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -38,6 +38,7 @@ #include "net/loginhandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -95,8 +96,7 @@ void WorldSelectDialog::postInit() WorldSelectDialog::~WorldSelectDialog() { - delete mWorldListModel; - mWorldListModel = nullptr; + delete2(mWorldListModel); } void WorldSelectDialog::action(const ActionEvent &event) |