Commit 82c952ff authored by Eoin O'Neill's avatar Eoin O'Neill 🍀

Fix Crash on Frame Priority Caching when Graphics Acceleration is Disabled.

Additional measures had to be taken to ensure that the frame cache exists before
requesting frame regeneration. Additionally, frame cache priority will also
ensure that the user wants background caching before attempting to prioritize
specific frames.

BUG:424037
parent 80bdcbdf
......@@ -292,7 +292,9 @@ KisAnimationCachePopulator::KisAnimationCachePopulator(KisPart *part)
}
KisAnimationCachePopulator::~KisAnimationCachePopulator()
{}
{
m_d->priorityFrames.clear();
}
bool KisAnimationCachePopulator::regenerate(KisAnimationFrameCacheSP cache, int frame)
{
......@@ -301,6 +303,8 @@ bool KisAnimationCachePopulator::regenerate(KisAnimationFrameCacheSP cache, int
void KisAnimationCachePopulator::requestRegenerationWithPriorityFrame(KisImageSP image, int frameIndex)
{
if (!m_d->calculateAnimationCacheInBackground) return;
m_d->priorityFrames.append(qMakePair(image, frameIndex));
if (m_d->state == Private::NotWaitingForAnything) {
......
......@@ -422,10 +422,13 @@ void KisTimeBasedItemModel::slotInternalScrubPreviewRequested(int time)
void KisTimeBasedItemModel::setScrubState(bool active)
{
if (!m_d->scrubInProgress && active) {
const int currentFrame = m_d->image->animationInterface()->currentUITime();
const bool hasCurrentFrameInCache = m_d->framesCache->frameStatus(currentFrame) == KisAnimationFrameCache::Cached;
if(!hasCurrentFrameInCache) {
KisPart::instance()->prioritizeFrameForCache(m_d->image, currentFrame);
if (m_d->framesCache) {
const int currentFrame = m_d->image->animationInterface()->currentUITime();
const bool hasCurrentFrameInCache = m_d->framesCache->frameStatus(currentFrame) == KisAnimationFrameCache::Cached;
if(!hasCurrentFrameInCache) {
KisPart::instance()->prioritizeFrameForCache(m_d->image, currentFrame);
}
}
m_d->scrubStartFrame = m_d->activeFrameIndex;
......
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