Kaydet (Commit) 05f97ef1 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1425723 silence 'Wrapper object use after free'

Change-Id: Ibcc0e5f28910bdd15c94579d754de3698ac8beb1
Reviewed-on: https://gerrit.libreoffice.org/46035Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a9a4c26e
......@@ -325,7 +325,16 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen
}
}
}
}
sal_uLong nIndex = pDoc->AddCondFormat(pFormat.release(), nTab);
ScConditionalFormat* pInsertedFormat = pDoc->GetCondFormList(nTab)->GetFormat(nIndex);
assert(pInsertedFormat && pInsertedFormat->GetKey() == nIndex);
mrParent.mvCondFormatData.push_back( { pInsertedFormat, nTab } );
if (bEligibleForCache)
{
// Not found in cache, replace oldest cache entry
sal_Int64 nOldestAge = -1;
size_t nIndexOfOldest = 0;
......@@ -337,17 +346,11 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen
nIndexOfOldest = (&aCacheEntry - &mrParent.maCache.front());
}
}
mrParent.maCache[nIndexOfOldest].mpFormat = pFormat.get();
mrParent.maCache[nIndexOfOldest].mpFormat = pInsertedFormat;
mrParent.maCache[nIndexOfOldest].mbSingleRelativeReference = bSingleRelativeReference;
mrParent.maCache[nIndexOfOldest].mpTokens.reset(pTokens);
mrParent.maCache[nIndexOfOldest].mnAge = 0;
}
sal_uLong nIndex = pDoc->AddCondFormat(pFormat.get(), nTab);
(void) nIndex; // Avoid 'unused variable' warning when assert() expands to empty
assert(pFormat->GetKey() == nIndex);
mrParent.mvCondFormatData.push_back( { pFormat.release(), nTab } );
}
ScXMLConditionalFormatContext::~ScXMLConditionalFormatContext()
......
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