Add SpriteReader wrapper to lock the sprite when Editor paints it.

+ Fixed critical bugs using "sprite resize" command and drawing
  the current editor (fixed usage of invalid memory pointers).
  It happens because the resize command is executed in a background
  thread, and at the same time the user can cancel or move a progress
  dialog (generating redraw events to the editor).
+ Anyway this change incorporates some other problems with effects
  where they keep locked the sprite in the whole command execution,
  so the effect preview cannot be visualized. This will be fixed with
  a refactor of the entire effect/preview stuff.
This commit is contained in:
David Capello 2011-03-08 01:25:46 -03:00
parent 6319af1676
commit 47669fe6f1

View File

@ -909,7 +909,8 @@ bool Editor::onProcessMessage(JMessage msg)
// Editor with sprite
else {
try {
//SpriteReader spriteReader(m_sprite);
// Lock the sprite to read/render it.
SpriteReader spriteReader(m_sprite);
int x1, y1, x2, y2;
// Draw the background outside of sprite's bounds
@ -951,7 +952,7 @@ bool Editor::onProcessMessage(JMessage msg)
}
}
catch (const LockedSpriteException&) {
// The sprite is locked to be read... we can draw an opaque
// The sprite is locked to be read, so we can draw an opaque
// background only.
View* view = View::getView(this);