Segmentation fault
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
// Constructor
|
||||
Notify::Notify(SDL_Renderer *renderer, string iconFile, string bitmapFile, string textFile, string soundFile, options_t *options)
|
||||
{
|
||||
//std::cout << "Construido Notify" << std::endl;
|
||||
|
||||
// Inicializa variables
|
||||
this->renderer = renderer;
|
||||
this->options = options;
|
||||
@@ -21,15 +23,29 @@ Notify::Notify(SDL_Renderer *renderer, string iconFile, string bitmapFile, strin
|
||||
// Destructor
|
||||
Notify::~Notify()
|
||||
{
|
||||
//std::cout << "Destruido Notify" << std::endl;
|
||||
|
||||
// Libera la memoria de los objetos
|
||||
delete iconTexture;
|
||||
delete text;
|
||||
if (iconTexture != nullptr)
|
||||
{
|
||||
delete iconTexture;
|
||||
}
|
||||
if (text != nullptr)
|
||||
{
|
||||
delete text;
|
||||
}
|
||||
JA_DeleteSound(sound);
|
||||
|
||||
for (auto notification : notifications)
|
||||
{
|
||||
delete notification.sprite;
|
||||
delete notification.texture;
|
||||
if (notification.sprite != nullptr)
|
||||
{
|
||||
delete notification.sprite;
|
||||
}
|
||||
if (notification.texture != nullptr)
|
||||
{
|
||||
delete notification.texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +132,14 @@ void Notify::clearFinishedNotifications()
|
||||
{
|
||||
if (notifications[i].state == ns_finished)
|
||||
{
|
||||
delete notifications[i].sprite;
|
||||
delete notifications[i].texture;
|
||||
if (notifications[i].sprite != nullptr)
|
||||
{
|
||||
delete notifications[i].sprite;
|
||||
}
|
||||
if (notifications[i].texture != nullptr)
|
||||
{
|
||||
delete notifications[i].texture;
|
||||
}
|
||||
notifications.erase(notifications.begin() + i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user