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/widgets | |
parent | 47cc515695fcd0b16467506e4984d2ec38fad4e4 (diff) | |
download | plus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.gz plus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.bz2 plus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.xz plus-0c35dab0ba366f85b40ef1795125521f1df8c264.zip |
simplify variables cleanup.
Diffstat (limited to 'src/gui/widgets')
33 files changed, 126 insertions, 166 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index dffcc7814..054a338aa 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -77,9 +77,10 @@ #include "gui/font.h" #include "gui/gui.h" - #include "gui/rect.h" +#include "utils/delete2.h" + #include "debug.h" int Button::mInstances = 0; @@ -362,8 +363,7 @@ Button::~Button() for (int mode = 0; mode < BUTTON_COUNT; mode ++) theme->unload(button[mode]); } - delete mVertexes2; - mVertexes2 = nullptr; + delete2(mVertexes2); if (mImageSet) { mImageSet->decRef(); diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index db2f2e2de..389b3f8cc 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -33,6 +33,7 @@ #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -77,8 +78,7 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget, CharacterDisplay::~CharacterDisplay() { - delete mPopup; - mPopup = nullptr; + delete2(mPopup); } void CharacterDisplay::setCharacter(Net::Character *const character) diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index d85bcccf4..67e027a96 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -28,6 +28,7 @@ #include "being/playerinfo.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/itempopup.h" @@ -36,7 +37,7 @@ #include "resources/image.h" -#include "gui/font.h" +#include "utils/delete2.h" #include "debug.h" @@ -81,8 +82,7 @@ DropShortcutContainer::~DropShortcutContainer() mBackgroundImg->decRef(); mBackgroundImg = nullptr; } - delete mItemPopup; - mItemPopup = nullptr; + delete2(mItemPopup); } void DropShortcutContainer::setWidget2(const Widget2 *const widget) diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index c0fcb8ecf..789d3e1aa 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -25,6 +25,8 @@ #include "resources/imageset.h" #include "resources/resourcemanager.h" +#include "utils/delete2.h" + #include "debug.h" namespace @@ -55,8 +57,7 @@ EmotePage::~EmotePage() mEmotes->decRef(); mEmotes = nullptr; } - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); } void EmotePage::draw(Graphics *graphics) diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 3248f1884..6feed2b12 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -30,12 +30,13 @@ #include "input/keydata.h" -#include "utils/dtor.h" - #include "listeners/actionlistener.h" #include "render/graphics.h" +#include "utils/delete2.h" +#include "utils/dtor.h" + #include "debug.h" float GuiTable::mAlpha = 1.0; @@ -126,8 +127,7 @@ GuiTable::~GuiTable() gui->removeDragged(this); uninstallActionListeners(); - delete mModel; - mModel = nullptr; + delete2(mModel); } const TableModel *GuiTable::getModel() const diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 1c6cf9ec3..ee2e35920 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -29,6 +29,7 @@ #include "being/playerinfo.h" +#include "gui/font.h" #include "gui/gui.h" #include "gui/viewport.h" @@ -46,9 +47,10 @@ #include "resources/image.h" -#include "gui/font.h" #include "listeners/selectionlistener.h" +#include "utils/delete2.h" + #include <algorithm> #include "debug.h" @@ -218,8 +220,7 @@ ItemContainer::~ItemContainer() if (theme) theme->unload(mSkin); - delete mItemPopup; - mItemPopup = nullptr; + delete2(mItemPopup); delete []mShowMatrix; } diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 2cf27ae30..efc6ef175 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -39,6 +39,8 @@ #include "input/mouseinput.h" +#include "utils/delete2.h" + #include <string> #include "debug.h" @@ -74,8 +76,7 @@ ItemLinkHandler::ItemLinkHandler() : ItemLinkHandler::~ItemLinkHandler() { - delete mItemPopup; - mItemPopup = nullptr; + delete2(mItemPopup); } void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 33ae1890d..420eb5578 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -46,6 +46,8 @@ #include "resources/image.h" +#include "utils/delete2.h" + #include "debug.h" ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget, @@ -95,10 +97,8 @@ ItemShortcutContainer::~ItemShortcutContainer() mBackgroundImg->decRef(); mBackgroundImg = nullptr; } - delete mItemPopup; - mItemPopup = nullptr; - delete mSpellPopup; - mSpellPopup = nullptr; + delete2(mItemPopup); + delete2(mSpellPopup); } void ItemShortcutContainer::setWidget2(const Widget2 *const widget) diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index 668334fd5..410c8188e 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -26,6 +26,8 @@ #include "gui/widgets/basiccontainer2.h" +#include "utils/delete2.h" + #include <cassert> #include "debug.h" @@ -45,10 +47,7 @@ LayoutCell &ContainerPlacer::operator() LayoutCell::~LayoutCell() { if (mType == ARRAY) - { - delete mArray; - mArray = nullptr; - } + delete2(mArray) } LayoutArray &LayoutCell::getArray() diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index a8bcec4ea..2116de113 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -27,6 +27,8 @@ #include "gui/viewport.h" +#include "utils/delete2.h" + #include "debug.h" Popup::Popup(const std::string &name, @@ -72,8 +74,7 @@ Popup::~Popup() { logger->log("Popup::~Popup(\"%s\")", mPopupName.c_str()); - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); if (mSkin) { diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index e2ff95228..ea4ef11bd 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -28,6 +28,8 @@ #include "gui/font.h" #include "gui/gui.h" +#include "utils/delete2.h" + #include "debug.h" int ProgressBar::mInstances = 0; @@ -100,8 +102,7 @@ ProgressBar::~ProgressBar() mSkin = nullptr; } Theme::unloadRect(mFillRect); - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); } void ProgressBar::logic() diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 8e86417bd..c960ad075 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -28,6 +28,8 @@ #include "resources/animation.h" #include "resources/imageset.h" +#include "utils/delete2.h" + #include "debug.h" ProgressIndicator::ProgressIndicator(Widget2 *const widget) : @@ -54,8 +56,7 @@ ProgressIndicator::~ProgressIndicator() if (gui) gui->removeDragged(this); - delete mIndicator; - mIndicator = nullptr; + delete2(mIndicator); } void ProgressIndicator::logic() diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 95323a170..2efa144c9 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -72,6 +72,8 @@ #include "resources/image.h" +#include "utils/delete2.h" + #include "debug.h" int ScrollArea::instances = 0; @@ -164,10 +166,8 @@ ScrollArea::~ScrollArea() } } - delete mVertexes; - mVertexes = nullptr; - delete mVertexes2; - mVertexes2 = nullptr; + delete2(mVertexes); + delete2(mVertexes2); setContent(nullptr); } diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index b1bb1e867..49be84b88 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -26,6 +26,8 @@ #include "gui/gui.h" +#include "utils/delete2.h" + #include "debug.h" float ShortcutContainer::mAlpha = 1.0; @@ -51,8 +53,7 @@ ShortcutContainer::~ShortcutContainer() if (gui) gui->removeDragged(this); - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); } void ShortcutContainer::widgetResized(const Event &event A_UNUSED) diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index cf9aad03d..e440631ad 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -76,6 +76,8 @@ #include "resources/image.h" +#include "utils/delete2.h" + #include "debug.h" ImageRect Slider::buttons[2]; @@ -130,8 +132,7 @@ Slider::~Slider() if (gui) gui->removeDragged(this); - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); mInstances--; if (mInstances == 0) { diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index add394a64..e86376812 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -36,6 +36,8 @@ #include "resources/image.h" +#include "utils/delete2.h" + #include "debug.h" SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget, @@ -78,8 +80,7 @@ SpellShortcutContainer::~SpellShortcutContainer() if (mBackgroundImg) mBackgroundImg->decRef(); mBackgroundImg = nullptr; - delete mSpellPopup; - mSpellPopup = nullptr; + delete2(mSpellPopup); } void SpellShortcutContainer::setWidget2(const Widget2 *const widget) diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 3cb6cb302..cf55fa10b 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -75,6 +75,8 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/tabs/tab.h" +#include "utils/delete2.h" + #include "debug.h" TabbedArea::TabbedArea(const Widget2 *const widget) : @@ -127,21 +129,14 @@ TabbedArea::~TabbedArea() remove(mTabContainer); remove(mWidgetContainer); - delete mTabContainer; - mTabContainer = nullptr; - delete mWidgetContainer; - mWidgetContainer = nullptr; + delete2(mTabContainer); + delete2(mWidgetContainer); for (size_t i = 0, sz = mTabsToDelete.size(); i < sz; i++) - { - delete mTabsToDelete[i]; - mTabsToDelete[i] = nullptr; - } + delete2(mTabsToDelete[i]) - delete mArrowButton[0]; - mArrowButton[0] = nullptr; - delete mArrowButton[1]; - mArrowButton[1] = nullptr; + delete2(mArrowButton[0]); + delete2(mArrowButton[1]); } void TabbedArea::enableScrollButtons(const bool enable) diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index 8fe9d707b..e52f935b3 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -45,6 +45,7 @@ #include "resources/db/itemdb.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -85,10 +86,8 @@ ChatTab::~ChatTab() if (chatWindow) chatWindow->removeTab(this); - delete mTextOutput; - mTextOutput = nullptr; - delete mScrollArea; - mScrollArea = nullptr; + delete2(mTextOutput); + delete2(mScrollArea); } void ChatTab::chatLog(std::string line, Own own, diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp index 6cf675635..89a9594c1 100644 --- a/src/gui/widgets/tabs/setup_audio.cpp +++ b/src/gui/widgets/tabs/setup_audio.cpp @@ -35,6 +35,7 @@ #include "gui/widgets/layouthelper.h" #include "gui/widgets/scrollarea.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -160,11 +161,8 @@ Setup_Audio::Setup_Audio(const Widget2 *const widget) : Setup_Audio::~Setup_Audio() { - delete mSoundModel; - mSoundModel = nullptr; - - delete mChannelsList; - mChannelsList = nullptr; + delete2(mSoundModel); + delete2(mChannelsList); } void Setup_Audio::apply() diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index eb7e695f4..00537ad05 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -34,6 +34,7 @@ #include "gui/widgets/textfield.h" #include "gui/widgets/textpreview.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -198,15 +199,9 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : Setup_Colors::~Setup_Colors() { if (mPreviewBox && mPreviewBox->getContent() == mPreview) - { - delete mTextPreview; - mTextPreview = nullptr; - } + delete2(mTextPreview) else - { - delete mPreview; - mPreview = nullptr; - } + delete2(mPreview) } void Setup_Colors::action(const ActionEvent &event) diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index b04937881..a29e0d797 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -41,6 +41,8 @@ #include "gui/models/listmodel.h" +#include "utils/delete2.h" + #include "debug.h" static int selectedData = 0; @@ -169,21 +171,14 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : Setup_Input::~Setup_Input() { - delete mKeyList; - mKeyList = nullptr; - delete mKeyListModel; - mKeyListModel = nullptr; - - delete mAssignKeyButton; - mAssignKeyButton = nullptr; - delete mUnassignKeyButton; - mUnassignKeyButton = nullptr; - delete mResetKeysButton; - mResetKeysButton = nullptr; + delete2(mKeyList); + delete2(mKeyListModel); + delete2(mAssignKeyButton); + delete2(mUnassignKeyButton); + delete2(mResetKeysButton); delete [] mActionDataSize; mActionDataSize = nullptr; - delete mScrollArea; - mScrollArea = nullptr; + delete2(mScrollArea); } void Setup_Input::apply() diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp index b3d7b78b9..4d2845656 100644 --- a/src/gui/widgets/tabs/setup_joystick.cpp +++ b/src/gui/widgets/tabs/setup_joystick.cpp @@ -34,6 +34,7 @@ #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -99,8 +100,7 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : Setup_Joystick::~Setup_Joystick() { - delete mNamesModel; - mNamesModel = nullptr; + delete2(mNamesModel); } void Setup_Joystick::action(const ActionEvent &event) diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 12cb614cd..ed8ba11ad 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -31,6 +31,7 @@ #include "configuration.h" #include "map.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -404,12 +405,9 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : Setup_Other::~Setup_Other() { - delete mProxyTypeList; - mProxyTypeList = nullptr; - delete mShortcutsList; - mShortcutsList = nullptr; - delete mDensityList; - mDensityList = nullptr; + delete2(mProxyTypeList); + delete2(mShortcutsList); + delete2(mDensityList); } void Setup_Other::apply() diff --git a/src/gui/widgets/tabs/setup_perfomance.cpp b/src/gui/widgets/tabs/setup_perfomance.cpp index 5a0566ec2..dad054e83 100644 --- a/src/gui/widgets/tabs/setup_perfomance.cpp +++ b/src/gui/widgets/tabs/setup_perfomance.cpp @@ -28,6 +28,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/setupitem.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -159,6 +160,5 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : Setup_Perfomance::~Setup_Perfomance() { - delete mTexturesList; - mTexturesList = nullptr; + delete2(mTexturesList); } diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index ca060477f..77a758cb4 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -37,6 +37,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/guitable.h" +#include "utils/delete2.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -81,10 +82,8 @@ public: ~PlayerTableModel() { freeWidgets(); - delete mListModel; - mListModel = nullptr; - delete mPlayers; - mPlayers = nullptr; + delete2(mListModel) + delete2(mPlayers) } int getRows() const override final @@ -159,9 +158,7 @@ public: void freeWidgets() { - delete mPlayers; - mPlayers = nullptr; - + delete2(mPlayers) delete_all(mWidgets); mWidgets.clear(); } @@ -266,8 +263,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : Setup_Relations::~Setup_Relations() { player_relations.removeListener(this); - delete mIgnoreActionChoicesModel; - mIgnoreActionChoicesModel = nullptr; + delete2(mIgnoreActionChoicesModel); } diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index 424828694..9b23fc3c3 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -37,6 +37,7 @@ #include "configuration.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "resources/resourcemanager.h" @@ -371,26 +372,13 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : Setup_Theme::~Setup_Theme() { - delete mInfo; - mInfo = nullptr; - - delete mThemesModel; - mThemesModel = nullptr; - - delete mFontsModel; - mFontsModel = nullptr; - - delete mFontSizeListModel; - mFontSizeListModel = nullptr; - - delete mNpcFontSizeListModel; - mNpcFontSizeListModel = nullptr; - - delete mLangListModel; - mLangListModel = nullptr; - - delete mInfo; - mInfo = nullptr; + delete2(mInfo); + delete2(mThemesModel); + delete2(mFontsModel); + delete2(mFontSizeListModel); + delete2(mNpcFontSizeListModel); + delete2(mLangListModel); + delete2(mInfo); } void Setup_Theme::updateInfo() diff --git a/src/gui/widgets/tabs/setup_touch.cpp b/src/gui/widgets/tabs/setup_touch.cpp index fb50ab4d5..eab39ccb0 100644 --- a/src/gui/widgets/tabs/setup_touch.cpp +++ b/src/gui/widgets/tabs/setup_touch.cpp @@ -27,6 +27,7 @@ #include "gui/widgets/setuptouchitem.h" #include "gui/widgets/scrollarea.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -126,10 +127,7 @@ Setup_Touch::Setup_Touch(const Widget2 *const widget) : Setup_Touch::~Setup_Touch() { - delete mSizeList; - mSizeList = nullptr; - delete mFormatList; - mFormatList = nullptr; - delete mActionsList; - mActionsList = nullptr; + delete2(mSizeList); + delete2(mFormatList); + delete2(mActionsList); } diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 416ae8c3c..dfe14fa2c 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -41,6 +41,7 @@ #include "render/rendererslistsdl.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/sdlhelper.h" @@ -309,14 +310,10 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : Setup_Video::~Setup_Video() { - delete mModeListModel; - mModeListModel = nullptr; - delete mModeList; - mModeList = nullptr; - delete mOpenGLListModel; - mOpenGLListModel = nullptr; - delete mDialog; - mDialog = nullptr; + delete2(mModeListModel); + delete2(mModeList); + delete2(mOpenGLListModel); + delete2(mDialog); } void Setup_Video::apply() diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp index 860b1d516..eb6591f9f 100644 --- a/src/gui/widgets/tabs/setup_visual.cpp +++ b/src/gui/widgets/tabs/setup_visual.cpp @@ -28,6 +28,7 @@ #include "client.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -215,18 +216,12 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : Setup_Visual::~Setup_Visual() { - delete mSpeachList; - mSpeachList = nullptr; - delete mAmbientFxList; - mAmbientFxList = nullptr; - delete mParticleList; - mParticleList = nullptr; - delete mParticleTypeList; - mParticleTypeList = nullptr; - delete mVSyncList; - mVSyncList = nullptr; - delete mScaleList; - mScaleList = nullptr; + delete2(mSpeachList); + delete2(mAmbientFxList); + delete2(mParticleList); + delete2(mParticleTypeList); + delete2(mVSyncList); + delete2(mScaleList); } void Setup_Visual::apply() diff --git a/src/gui/widgets/tabs/setuptabscroll.cpp b/src/gui/widgets/tabs/setuptabscroll.cpp index 9c185b2bb..cd169e0bf 100644 --- a/src/gui/widgets/tabs/setuptabscroll.cpp +++ b/src/gui/widgets/tabs/setuptabscroll.cpp @@ -24,6 +24,8 @@ #include "gui/widgets/setupitem.h" #include "gui/widgets/vertcontainer.h" +#include "utils/delete2.h" + #include "debug.h" SetupTabScroll::SetupTabScroll(const Widget2 *const widget) : @@ -41,10 +43,7 @@ SetupTabScroll::SetupTabScroll(const Widget2 *const widget) : SetupTabScroll::~SetupTabScroll() { mScroll = nullptr; - - delete mContainer; - mContainer = nullptr; - + delete2(mContainer); removeItems(); } diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 32d0cf2a6..c2a6c0207 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -75,6 +75,8 @@ #include "resources/image.h" +#include "utils/delete2.h" + #include "debug.h" int Tab::mInstances = 0; @@ -129,16 +131,14 @@ Tab::~Tab() theme->unload(tabImg[mode]); } - delete mLabel; - mLabel = nullptr; + delete2(mLabel); if (mImage) { mImage->decRef(); mImage = nullptr; } - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); } void Tab::init() diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index d1f19785f..f89d2ead2 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -78,6 +78,7 @@ #include "resources/image.h" #include "utils/copynpaste.h" +#include "utils/delete2.h" #include "utils/timer.h" #undef DELETE // Win32 compatibility hack @@ -154,8 +155,7 @@ TextField::~TextField() if (gui) gui->removeDragged(this); - delete mPopupMenu; - mPopupMenu = nullptr; + delete2(mPopupMenu); instances--; if (instances == 0) diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 4f8bc88b3..9e032f75b 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -82,6 +82,8 @@ #include "resources/cursor.h" #include "resources/image.h" +#include "utils/delete2.h" + #include "debug.h" const int resizeMask = 8 + 4 + 2 + 1; @@ -219,8 +221,7 @@ Window::~Window() saveWindowState(); - delete mLayout; - mLayout = nullptr; + delete2(mLayout); while (!mWidgets.empty()) delete mWidgets.front(); @@ -228,8 +229,7 @@ Window::~Window() mWidgets.clear(); removeWidgetListener(this); - delete mVertexes; - mVertexes = nullptr; + delete2(mVertexes); windowInstances--; @@ -1262,8 +1262,7 @@ void Window::reflowLayout(int w, int h) return; mLayout->reflow(w, h); - delete mLayout; - mLayout = nullptr; + delete2(mLayout); setContentSize(w, h); } |