mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Fix some memleaks from GUIButtonImage (#13564)
* `m_foreground_image` was grabbed, but not dropped in the destructor. * `m_image` was created with new. It is grabbed by itself and by the env (not only by the env!, so it's an owning ptr). This owning ptr also was never dropped.
This commit is contained in:
parent
1b51ff333a
commit
553dc02deb
2 changed files with 13 additions and 19 deletions
|
@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "guiButton.h"
|
||||
#include "IGUIButton.h"
|
||||
#include "guiAnimatedImage.h"
|
||||
#include "irr_ptr.h"
|
||||
|
||||
using namespace irr;
|
||||
|
||||
|
@ -33,7 +34,7 @@ public:
|
|||
s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc,
|
||||
bool noclip = false);
|
||||
|
||||
void setForegroundImage(video::ITexture *image = nullptr,
|
||||
void setForegroundImage(irr_ptr<video::ITexture> image = nullptr,
|
||||
const core::rect<s32> &middle = core::rect<s32>());
|
||||
|
||||
//! Set element properties from a StyleSpec
|
||||
|
@ -46,6 +47,6 @@ public:
|
|||
const wchar_t *tooltiptext = L"");
|
||||
|
||||
private:
|
||||
video::ITexture *m_foreground_image = nullptr;
|
||||
GUIAnimatedImage *m_image;
|
||||
irr_ptr<video::ITexture> m_foreground_image;
|
||||
irr_ptr<GUIAnimatedImage> m_image;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue