Kaydet (Commit) 5e381ffb authored tarafından Caolán McNamara's avatar Caolán McNamara

allow events to accumulate past limit if an exception is pending

Change-Id: Ic54c31961b887e06267aba1ceb0378508d24ded0
Reviewed-on: https://gerrit.libreoffice.org/42411Tested-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 9d837f19
...@@ -550,6 +550,13 @@ Event& Entity::getEvent( CallbackType aType ) ...@@ -550,6 +550,13 @@ Event& Entity::getEvent( CallbackType aType )
return maSharedEvent; return maSharedEvent;
EventList& rEventList = getEventList(); EventList& rEventList = getEventList();
if (mnProducedEventsSize == rEventList.maEvents.size())
{
SAL_WARN_IF(!maSavedException.hasValue(), "sax",
"Event vector should only exceed " << mnEventListSize <<
" temporarily while an exception is pending");
rEventList.maEvents.resize(mnProducedEventsSize + 1);
}
Event& rEvent = rEventList.maEvents[mnProducedEventsSize++]; Event& rEvent = rEventList.maEvents[mnProducedEventsSize++];
rEvent.maType = aType; rEvent.maType = aType;
return rEvent; return rEvent;
...@@ -927,7 +934,7 @@ void FastSaxParserImpl::produce( bool bForceFlush ) ...@@ -927,7 +934,7 @@ void FastSaxParserImpl::produce( bool bForceFlush )
{ {
Entity& rEntity = getEntity(); Entity& rEntity = getEntity();
if (bForceFlush || if (bForceFlush ||
rEntity.mnProducedEventsSize == Entity::mnEventListSize) rEntity.mnProducedEventsSize >= Entity::mnEventListSize)
{ {
osl::ResettableMutexGuard aGuard(rEntity.maEventProtector); osl::ResettableMutexGuard aGuard(rEntity.maEventProtector);
......
...@@ -103,6 +103,8 @@ public: ...@@ -103,6 +103,8 @@ public:
static const OUString GetSubStorageName( const SfxFilter& rFltr ); static const OUString GetSubStorageName( const SfxFilter& rFltr );
}; };
extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportFODT(SvStream &rStream);
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
...@@ -122,6 +122,7 @@ public: ...@@ -122,6 +122,7 @@ public:
//EDITING: undo search&replace corrupt text when searching backward //EDITING: undo search&replace corrupt text when searching backward
void testReplaceBackward(); void testReplaceBackward();
void testRedlineFrame(); void testRedlineFrame();
void testThreadedException();
void testBookmarkCopy(); void testBookmarkCopy();
void testFdo69893(); void testFdo69893();
void testFdo70807(); void testFdo70807();
...@@ -276,6 +277,7 @@ public: ...@@ -276,6 +277,7 @@ public:
CPPUNIT_TEST(testReplaceForward); CPPUNIT_TEST(testReplaceForward);
CPPUNIT_TEST(testReplaceBackward); CPPUNIT_TEST(testReplaceBackward);
CPPUNIT_TEST(testRedlineFrame); CPPUNIT_TEST(testRedlineFrame);
CPPUNIT_TEST(testThreadedException);
CPPUNIT_TEST(testBookmarkCopy); CPPUNIT_TEST(testBookmarkCopy);
CPPUNIT_TEST(testFdo69893); CPPUNIT_TEST(testFdo69893);
CPPUNIT_TEST(testFdo70807); CPPUNIT_TEST(testFdo70807);
...@@ -520,6 +522,17 @@ void SwUiWriterTest::testRedlineFrame() ...@@ -520,6 +522,17 @@ void SwUiWriterTest::testRedlineFrame()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
} }
void SwUiWriterTest::testThreadedException()
{
SvFileStream aFileStream(m_directories.getURLFromSrc(DATA_DIRECTORY) + "threadedException.fodt", StreamMode::READ);
//threaded reading only kicks in if there is sufficient buffer to make it worthwhile, so read
//from a SvFileStream to ensure that
bool bRes = TestImportFODT(aFileStream);
CPPUNIT_ASSERT(!bRes);
}
void SwUiWriterTest::testBookmarkCopy() void SwUiWriterTest::testBookmarkCopy()
{ {
SwDoc * pDoc(createDoc()); SwDoc * pDoc(createDoc());
......
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