From 3c7ec0569a4fce157e608021133bdc6cac679c10 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 8 Jun 2011 15:39:25 +0300 Subject: Zero variables after calling decRef(). --- src/animatedsprite.cpp | 3 +++ src/gui/emotepopup.cpp | 3 +++ src/gui/itempopup.cpp | 3 +++ src/gui/skilldialog.cpp | 3 +++ src/gui/widgets/avatarlistbox.cpp | 6 ++++++ src/gui/widgets/desktop.cpp | 3 +++ src/gui/widgets/dropshortcutcontainer.cpp | 3 +++ src/gui/widgets/emoteshortcutcontainer.cpp | 3 +++ src/gui/widgets/resizegrip.cpp | 3 +++ src/imageparticle.cpp | 1 + src/imagesprite.cpp | 3 +++ src/item.cpp | 3 +++ src/map.cpp | 3 +++ src/particleemitter.cpp | 4 ++++ src/resources/ambientlayer.cpp | 3 +++ src/resources/image.cpp | 3 +++ src/resources/spritedef.cpp | 3 +++ 17 files changed, 53 insertions(+) diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 80a2014eb..215fd9ad6 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -72,7 +72,10 @@ AnimatedSprite *AnimatedSprite::load(const std::string &filename, int variant) AnimatedSprite::~AnimatedSprite() { if (mSprite) + { mSprite->decRef(); + mSprite = 0; + } } bool AnimatedSprite::reset() diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index d23443a2f..3a754d0e3 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -77,7 +77,10 @@ EmotePopup::EmotePopup(): EmotePopup::~EmotePopup() { if (mSelectionImage) + { mSelectionImage->decRef(); + mSelectionImage = 0; + } } void EmotePopup::draw(gcn::Graphics *graphics) diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index e7def2234..f5117ed5a 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -92,7 +92,10 @@ ItemPopup::~ItemPopup() { Image *image = mIcon->getImage(); if (image) + { image->decRef(); + image = 0; + } } } diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index a164d59d7..14e245ae1 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -87,7 +87,10 @@ struct SkillInfo ~SkillInfo() { if (icon) + { icon->decRef(); + icon = 0; + } } void setIcon(const std::string &iconPath) diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index c4737160b..a7331ae78 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -78,9 +78,15 @@ AvatarListBox::~AvatarListBox() if (instances == 0) { if (onlineIcon) + { onlineIcon->decRef(); + onlineIcon = 0; + } if (offlineIcon) + { offlineIcon->decRef(); + offlineIcon = 0; + } } } diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 8b6217da2..f7183553f 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -60,7 +60,10 @@ Desktop::Desktop() Desktop::~Desktop() { if (mWallpaper) + { mWallpaper->decRef(); + mWallpaper = 0; + } } void Desktop::reloadWallpaper() diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 224830d8f..fd920ffa4 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -77,7 +77,10 @@ DropShortcutContainer::DropShortcutContainer(): DropShortcutContainer::~DropShortcutContainer() { if (mBackgroundImg) + { mBackgroundImg->decRef(); + mBackgroundImg = 0; + } delete mItemPopup; mItemPopup = 0; } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index c45c0a44c..bdba4a807 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -87,7 +87,10 @@ EmoteShortcutContainer::~EmoteShortcutContainer() delete mEmotePopup; if (mBackgroundImg) + { mBackgroundImg->decRef(); + mBackgroundImg = 0; + } } void EmoteShortcutContainer::draw(gcn::Graphics *graphics) diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index cf017b9ec..f477e51a8 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -67,7 +67,10 @@ ResizeGrip::~ResizeGrip() mInstances--; if (mInstances == 0 && gripImage) + { gripImage->decRef(); + gripImage = 0; + } } void ResizeGrip::draw(gcn::Graphics *graphics) diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp index 0f52135c9..ca220bcc4 100644 --- a/src/imageparticle.cpp +++ b/src/imageparticle.cpp @@ -60,6 +60,7 @@ ImageParticle::~ImageParticle() ImageParticle::imageParticleCountByName[name] --; mImage->decRef(); + mImage = 0; } setMap(0); } diff --git a/src/imagesprite.cpp b/src/imagesprite.cpp index e0c27e3d7..803c9c24f 100644 --- a/src/imagesprite.cpp +++ b/src/imagesprite.cpp @@ -42,7 +42,10 @@ ImageSprite::ImageSprite(Image *image): ImageSprite::~ImageSprite() { if (mImage) + { mImage->decRef(); + mImage = 0; + } } bool ImageSprite::draw(Graphics* graphics, int posX, int posY) const diff --git a/src/item.cpp b/src/item.cpp index e59d0c334..f74d0e837 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -48,7 +48,10 @@ Item::Item(int id, int quantity, int refine, unsigned char color, Item::~Item() { if (mImage) + { mImage->decRef(); + mImage = 0; + } } void Item::setId(int id, unsigned char color) diff --git a/src/map.cpp b/src/map.cpp index 69963b354..2c8dc90e2 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1743,7 +1743,10 @@ MapItem::MapItem(int type, std::string comment, int x, int y): MapItem::~MapItem() { if (mImage) + { mImage->decRef(); + mImage = 0; + } } void MapItem::setType(int type) diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 5f107abb7..ad67d622b 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -446,9 +446,13 @@ ParticleEmitter::~ParticleEmitter() if (*i) (*i)->decRef(); } + mTempSets.clear(); if (mParticleImage) + { mParticleImage->decRef(); + mParticleImage = 0; + } } diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp index 92d9eb43e..a0f3803eb 100644 --- a/src/resources/ambientlayer.cpp +++ b/src/resources/ambientlayer.cpp @@ -74,7 +74,10 @@ AmbientLayer::AmbientLayer(Image *img, float parallax, AmbientLayer::~AmbientLayer() { if (mImage) + { mImage->decRef(); + mImage = 0; + } } void AmbientLayer::update(int timePassed, float dx, float dy) diff --git a/src/resources/image.cpp b/src/resources/image.cpp index aa5c33488..4a89ae636 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -828,7 +828,10 @@ SubImage::~SubImage() mGLImage = 0; #endif if (mParent) + { mParent->decRef(); + mParent = 0; + } } Image *SubImage::getSubImage(int x, int y, int w, int h) diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 37610f659..79e665f4c 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -359,7 +359,10 @@ SpriteDef::~SpriteDef() i != mImageSets.end(); ++i) { if (i->second) + { i->second->decRef(); + i->second = 0; + } } } -- cgit v1.2.3-70-g09d2