tdf#156856: close write access before using AlphaMask

Change-Id: I432417f03d378f81c890ce6c313a2f140b564a60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155955
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2023-08-22 17:45:03 +03:00
parent 6761b79e7b
commit 3cf3e0e21d
5 changed files with 52 additions and 2 deletions

View file

@ -0,0 +1,13 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call sd_import_test,_skia))
$(eval $(call gb_CppunitTest_use_vcl_non_headless,sd_import_tests_skia))
# vim: set noet sw=4 ts=4:

View file

@ -33,6 +33,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sd,\
CppunitTest_sd_uimpress) \
CppunitTest_sd_import_tests \
CppunitTest_sd_import_tests2 \
CppunitTest_sd_import_tests_skia \
CppunitTest_sd_import_tests-smartart \
CppunitTest_sd_export_tests-ooxml1 \
CppunitTest_sd_export_tests-ooxml2 \

Binary file not shown.

View file

@ -0,0 +1,36 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <sal/config.h>
#include "sdmodeltestbase.hxx"
#include <vcl/skia/SkiaHelper.hxx>
// Tests here are expected to run with Skia enabled, similar to CppunitTest_vcl_skia.
// At some point, this could be true for all tests?
class SdImportTestSkia : public SdModelTestBase
{
public:
SdImportTestSkia()
: SdModelTestBase("/sd/qa/unit/data/")
{
}
};
CPPUNIT_TEST_FIXTURE(SdImportTestSkia, testTdf156856)
{
// Loading the document must not fail assertion
createSdImpressDoc("pptx/tdf156856.pptx");
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View file

@ -635,10 +635,10 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
// Process data after import.
for (auto& rContext : aContexts)
{
if(rContext.m_pAlphaAccess) // Need to move the AlphaMask back to the BitmapEx.
*rContext.m_pGraphic = BitmapEx( rContext.m_pGraphic->GetBitmapExRef().GetBitmap(), rContext.mAlphaMask );
rContext.m_pAccess.reset();
rContext.m_pAlphaAccess.reset();
if (!rContext.mAlphaMask.IsEmpty()) // Need to move the AlphaMask back to the BitmapEx.
*rContext.m_pGraphic = BitmapEx( rContext.m_pGraphic->GetBitmapExRef().GetBitmap(), rContext.mAlphaMask );
if (rContext.m_nStatus == ERRCODE_NONE && (rContext.m_eLinkType != GfxLinkType::NONE) && !rContext.m_pGraphic->GetReaderContext())
{