[aseprite] 15/134: Fix crash in Editor::drawOneSpriteUnclippedRect() if a temporary surface cannot be created (fix #413)

Tobias Hansen thansen at moszumanska.debian.org
Sat Mar 14 17:09:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 80073e65d1c19bdf1f7cba17c2d5d8af8c571fb8
Author: David Capello <davidcapello at gmail.com>
Date:   Sun Oct 26 00:33:21 2014 -0300

    Fix crash in Editor::drawOneSpriteUnclippedRect() if a temporary surface cannot be created (fix #413)
---
 src/app/ui/editor/editor.cpp    | 8 +++++---
 src/she/alleg4/alleg4_surface.h | 6 ++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp
index 3d7c41c..e49b09f 100644
--- a/src/app/ui/editor/editor.cpp
+++ b/src/app/ui/editor/editor.cpp
@@ -412,9 +412,11 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& rc, in
       }
 
       she::Surface* tmp(she::instance()->createRgbaSurface(width, height));
-      convert_image_to_surface(rendered, m_sprite->getPalette(m_frame),
-        tmp, 0, 0, 0, 0, width, height);
-      g->blit(tmp, 0, 0, dest_x, dest_y, width, height);
+      if (tmp->nativeHandle()) {
+        convert_image_to_surface(rendered, m_sprite->getPalette(m_frame),
+          tmp, 0, 0, 0, 0, width, height);
+        g->blit(tmp, 0, 0, dest_x, dest_y, width, height);
+      }
       tmp->dispose();
     }
   }
diff --git a/src/she/alleg4/alleg4_surface.h b/src/she/alleg4/alleg4_surface.h
index 4bc12f8..8392472 100644
--- a/src/she/alleg4/alleg4_surface.h
+++ b/src/she/alleg4/alleg4_surface.h
@@ -59,8 +59,10 @@ namespace she {
     }
 
     ~Alleg4Surface() {
-      if (m_destroy & DestroyHandle)
-        destroy_bitmap(m_bmp);
+      if (m_destroy & DestroyHandle) {
+        if (m_bmp)
+          destroy_bitmap(m_bmp);
+      }
     }
 
     // Surface implementation

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list