Commit ac020c6c authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix random crash when swap-file location has not got enough disk space

Lockfree hash table iterators have a requirement of no-concurrent-inserts,
so we must ensure that the swapper and pooler do *not* insert any tiles,
why iteration is in progress. KisTileDataStore::trySwapTileData() is called
exactly from inside of the swapper iteration loop.

If we break this requirement, the insert operation may request a table
migration, and the iterator will continue iterating the old, invalid,

The actual crash happened after line 'item = iter->next()' in
KisTileDataSwapper::pass(), which actually returned value '1', meaning
"Redirect". Address 0x0000000000000029 is a fetch of
KisTileData::m_mementoFlag (offset 0x28) with 'this' set to 0x01 :)

parent 2ffdc5b0
......@@ -344,6 +344,9 @@ public:
bool isValid() const
KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(m_value != Value(ValueTraits::Redirect), false);
return m_value != Value(ValueTraits::NullValue);
......@@ -262,12 +262,9 @@ bool KisTileDataStore::trySwapTileData(KisTileData *td)
if (!td->m_swapLock.tryLockForWrite()) return result;
if (td->data()) {
if (m_swappedStore.trySwapOutTileData(td)) {
result = true;
} else {
result = false;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment