Add some debug checks in ExpandCelCanvas

This commit is contained in:
David Capello 2015-08-18 18:34:58 -03:00
parent c0e1852f9f
commit b4568f1fdc
1 changed files with 10 additions and 0 deletions

View File

@ -30,6 +30,10 @@
namespace {
// We cannot have two ExpandCelCanvas instances at the same time
// (because we share ImageBuffers between them).
static app::ExpandCelCanvas* singleton = nullptr;
static doc::ImageBufferPtr src_buffer;
static doc::ImageBufferPtr dst_buffer;
@ -68,6 +72,9 @@ ExpandCelCanvas::ExpandCelCanvas(Site site,
, m_committed(false)
, m_transaction(transaction)
{
ASSERT(!singleton);
singleton = this;
create_buffers();
if (m_layer->isImage()) {
@ -116,6 +123,9 @@ ExpandCelCanvas::ExpandCelCanvas(Site site,
ExpandCelCanvas::~ExpandCelCanvas()
{
ASSERT(singleton == this);
singleton = nullptr;
try {
if (!m_committed && !m_closed)
rollback();