[Libreoffice-commits] core.git: Branch 'private/jmux/scheduler-fixes' - 17 commits - configure.ac filter/source include/svx reportdesign/source sc/CppunitTest_sc_databaserangeobj.mk sc/CppunitTest_sc_datapilottableobj.mk sc/CppunitTest_sc_namedrangeobj.mk sc/CppunitTest_sc_namedrangesobj.mk sc/CppunitTest_sc_tablesheetobj.mk sc/source sd/source sfx2/source solenv/gbuild svl/source svtools/source svx/source sw/CppunitTest_sw_uiwriter.mk sw/inc sw/source test/source vcl/inc vcl/osx vcl/source vcl/unx vcl/win writerfilter/source
Jan-Marek Glogowski
glogow at fbihome.de
Fri Oct 6 17:45:00 UTC 2017
Rebased ref, commits from common ancestor:
commit eff62066d4dc945053e3c003e0aa8adf198d942c
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Fri Sep 29 22:24:15 2017 +0200
WIP Fix unprocessed shutdown events
DO NOT MERGE!
This is just a test patch, since I can't reproduce the
Jenkins failures locally. It's not "make check" tested,
just "make vcl".
This fixes multiple problems, which I missed.
We're not interested in WM_TIMER events, but in active
SAL_MSG_TIMER_CALLBACK, which is indicated by PollForMessage().
This includes a revert of "tdf#38915: don't wait on message queue
if application already has quit.", which is commited as
f054b9187155bc32b7d06808aea87127cb0a3a4f.
We can't ignore the wait flag, just because the application will
quit, as we have to deliver the expected event announced by
pTimer->PollForMessage().
And we don't try to "clean" the message queue, as invalid events
are simply identified by there version ID.
On Mac we can probably drop the workaround. We can't wait for a
timer event in a redirected dispatch_async, for whatever reason.
Change-Id: If806d41c6fcfce10b0c4c7fdcf1df5df6ac16a1d
diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h
index 5ad6a1718f19..532765e050f0 100644
--- a/vcl/inc/win/saltimer.h
+++ b/vcl/inc/win/saltimer.h
@@ -34,7 +34,7 @@ class WinSalTimer final : public SalTimer, protected VersionedEvent
void ImplStart( sal_uIntPtr nMS );
void ImplStop();
- void ImplEmitTimerCallback();
+ void ImplHandleTimerEvent( WPARAM aWPARAM );
public:
WinSalTimer();
@@ -43,16 +43,9 @@ public:
virtual void Start(sal_uIntPtr nMS) override;
virtual void Stop() override;
- inline bool IsValidWPARAM( WPARAM wParam ) const;
-
inline bool PollForMessage() const;
};
-inline bool WinSalTimer::IsValidWPARAM( WPARAM aWPARAM ) const
-{
- return IsValidEventVersion( static_cast<sal_Int32>( aWPARAM ) );
-}
-
inline bool WinSalTimer::PollForMessage() const
{
return m_bPollForMessage;
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index d475f30275b0..0334087f57cf 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -570,10 +570,10 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
// handle available events
NSEvent* pEvent = nil;
NSTimeInterval now = [[NSProcessInfo processInfo] systemUptime];
+ AquaSalInstance *pInst = GetSalData()->mpInstance;
do
{
SolarMutexReleaser aReleaser;
-
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12
pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask
@@ -591,6 +591,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
[NSApp updateWindows];
+ if ( AquaSalInstance::AnyInput( VclInputFlags::TIMER ) && !pInst->mbNoYieldLock && !bHadEvent )
+ continue;
if ( !bHandleAllCurrentEvents || !pEvent || now < [pEvent timestamp] )
break;
}
@@ -618,7 +620,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
}
// collect update rectangles
- for( auto pSalFrame : GetSalData()->mpInstance->getFrames() )
+ for( auto pSalFrame : pInst->getFrames() )
{
AquaSalFrame* pFrame = static_cast<AquaSalFrame*>( pSalFrame );
if( pFrame->mbShown && ! pFrame->maInvalidRect.IsEmpty() )
diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx
index 877fdfae85b5..e6336fbedd6e 100644
--- a/vcl/osx/saltimer.cxx
+++ b/vcl/osx/saltimer.cxx
@@ -44,30 +44,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
subtype: nEventId
data1: nUserData
data2: 0];
- assert( pEvent );
if ( nil == pEvent )
- return;
- if ( NO == bAtStart )
- {
- // nextEventMatchingMask has to run in the main thread!
- assert([NSThread isMainThread]);
-
- // Posting an event to the end of an empty queue fails,
- // so we peek the queue and post to the start, if empty.
- // Some Qt bugs even indicate nextEvent without dequeue
- // sometimes blocks, so we dequeue and re-add the event.
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
-// 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12
- NSEvent* pPeekEvent = [NSApp nextEventMatchingMask: NSAnyEventMask
-SAL_WNODEPRECATED_DECLARATIONS_POP
- untilDate: nil
- inMode: NSDefaultRunLoopMode
- dequeue: YES];
- if ( nil == pPeekEvent )
- bAtStart = YES;
- else
- [NSApp postEvent: pPeekEvent atStart: YES];
- }
+ std::abort();
[NSApp postEvent: pEvent atStart: bAtStart];
}
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 8fd26ec79a55..5fe9e0b302ab 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -172,7 +172,7 @@ void Scheduler::ImplDeInitScheduler()
SAL_INFO( "vcl.schedule.deinit", "DeInit the scheduler - finished" );
SAL_WARN_IF( 0 != nActiveTasks, "vcl.schedule.deinit", "DeInit active tasks: "
<< nActiveTasks << " (ignored: " << nIgnoredTasks << ")" );
-// assert( nIgnoredTasks == nActiveTasks );
+ assert( nIgnoredTasks == nActiveTasks );
#endif
rSchedCtx.mpFirstSchedulerData = nullptr;
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index a0a323b2d037..1eb8b4a04bfb 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -514,8 +514,7 @@ static bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
if ( bHandleAllCurrentEvents )
nLastTicks = nCurTicks;
- // Also check that we don't wait when application already has quit
- if ( bWait && !bWasMsg && !pSVData->maAppData.mbAppQuit )
+ if ( bWait && !bWasMsg )
{
if ( GetMessageW( &aMsg, nullptr, 0, 0 ) )
{
@@ -540,8 +539,6 @@ bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
SolarMutexReleaser aReleaser;
if ( !IsMainThread() )
{
- // If you change the SendMessageW function, you might need to update
- // the PeekMessage( ... PM_QS_POSTMESSAGE) calls!
bDidWork = SendMessageW( mhComWnd, SAL_MSG_THREADYIELD,
(WPARAM) false, (LPARAM) bHandleAllCurrentEvents );
if ( !bDidWork && bWait )
@@ -659,17 +656,7 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, i
{
WinSalTimer *const pTimer = static_cast<WinSalTimer*>( ImplGetSVData()->maSchedCtx.mpSalTimer );
assert( pTimer != nullptr );
- MSG aMsg;
- bool bValidMSG = pTimer->IsValidWPARAM( wParam );
- // PM_QS_POSTMESSAGE is needed, so we don't process the SendMessage from DoYield!
- while ( PeekMessageW(&aMsg, pInst->mhComWnd, SAL_MSG_TIMER_CALLBACK,
- SAL_MSG_TIMER_CALLBACK, PM_REMOVE | PM_NOYIELD | PM_QS_POSTMESSAGE) )
- {
- assert( !bValidMSG && "Unexpected non-last valid message" );
- bValidMSG = pTimer->IsValidWPARAM( aMsg.wParam );
- }
- if ( bValidMSG )
- pTimer->ImplEmitTimerCallback();
+ pTimer->ImplHandleTimerEvent( wParam );
break;
}
}
@@ -700,6 +687,13 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
{
MSG aMsg;
+ if ( nType & VclInputFlags::TIMER )
+ {
+ const WinSalTimer* pTimer = static_cast<WinSalTimer*>( ImplGetSVData()->maSchedCtx.mpSalTimer );
+ if ( pTimer && pTimer->PollForMessage() )
+ return true;
+ }
+
if ( (nType & VCL_INPUT_ANY) == VCL_INPUT_ANY )
{
// revert bugfix for #108919# which never reported timeouts when called from the timer handler
@@ -756,15 +750,6 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
return true;
}
- if ( nType & VclInputFlags::TIMER )
- {
- // Test for timer input
- if ( PeekMessageW( &aMsg, nullptr, WM_TIMER, WM_TIMER,
- PM_NOREMOVE | PM_NOYIELD ) )
- return true;
-
- }
-
if ( nType & VclInputFlags::OTHER )
{
// Test for any input
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 93b93fbb832f..8354886fbcd6 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -50,12 +50,6 @@ void WinSalTimer::ImplStop()
// Keep both after DeleteTimerQueueTimer, because they are set in SalTimerProc
InvalidateEvent();
m_bPollForMessage = false;
-
- // remove as many pending SAL_MSG_TIMER_CALLBACK messages as possible
- // PM_QS_POSTMESSAGE is needed, so we don't process the SendMessage from DoYield!
- MSG aMsg;
- while ( PeekMessageW(&aMsg, pInst->mhComWnd, SAL_MSG_TIMER_CALLBACK,
- SAL_MSG_TIMER_CALLBACK, PM_REMOVE | PM_NOYIELD | PM_QS_POSTMESSAGE) );
}
void WinSalTimer::ImplStart( sal_uLong nMS )
@@ -75,9 +69,7 @@ void WinSalTimer::ImplStart( sal_uLong nMS )
// probably WT_EXECUTEONLYONCE is not needed, but it enforces Period
// to be 0 and should not hurt; also see
// https://www.microsoft.com/msj/0499/pooling/pooling.aspx
- CreateTimerQueueTimer(&m_nTimerId, nullptr, SalTimerProc,
- reinterpret_cast<void*>(
- sal_IntPtr(GetNextEventVersion())),
+ CreateTimerQueueTimer(&m_nTimerId, nullptr, SalTimerProc, this,
nMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
}
@@ -126,12 +118,11 @@ void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
{
__try
{
- // always post message when the timer fires, we will remove the ones
- // that happened during execution of the callback later directly from
- // the message queue
- BOOL const ret = PostMessageW(GetSalData()->mpInstance->mhComWnd,
- SAL_MSG_TIMER_CALLBACK,
- reinterpret_cast<WPARAM>(data), 0);
+ WinSalTimer *pTimer = reinterpret_cast<WinSalTimer*>( data );
+ pTimer->m_bPollForMessage = true;
+ BOOL const ret = PostMessageW(
+ GetSalData()->mpInstance->mhComWnd, SAL_MSG_TIMER_CALLBACK,
+ static_cast<WPARAM>(pTimer->GetNextEventVersion()), 0 );
#if OSL_DEBUG_LEVEL > 0
if (0 == ret) // SEH prevents using SAL_WARN here?
fputs("ERROR: PostMessage() failed!\n", stderr);
@@ -142,8 +133,12 @@ void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
}
}
-void WinSalTimer::ImplEmitTimerCallback()
+void WinSalTimer::ImplHandleTimerEvent( WPARAM aWPARAM )
{
+ assert( aWPARAM <= SAL_MAX_INT32 );
+ if ( !IsValidEventVersion( static_cast<sal_Int32>( aWPARAM ) ) )
+ return;
+
// Test for MouseLeave
SalTestMouseLeave();
commit 141fe1c5e7fbf67a083b34e49e19b6ea78a0eb2b
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Fri Oct 6 12:53:05 2017 +0200
Process all pending events during Cppunit setUp
Larger unit tests collect a lot of events, which are just processed
on shutdown. But since the Scheduler is just an unsorted linked
list, processing these in order is O(n^2) for lookup, which really
adds up, e.g. sw_ooxmlexport8 has 35047 tasks on shutdown.
So this just processes all pending events before running each unit
test.
Also adds missing spellchecking components to some calc tests.
Change-Id: Icf12146015afc17a1f52f79c18f248b72650ad46
Reviewed-on: https://gerrit.libreoffice.org/43199
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/sc/CppunitTest_sc_databaserangeobj.mk b/sc/CppunitTest_sc_databaserangeobj.mk
index 528829687311..ff48e3c0a1f6 100644
--- a/sc/CppunitTest_sc_databaserangeobj.mk
+++ b/sc/CppunitTest_sc_databaserangeobj.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_databaserangeobj,\
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
+ linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
diff --git a/sc/CppunitTest_sc_datapilottableobj.mk b/sc/CppunitTest_sc_datapilottableobj.mk
index ea953602add4..3ba76c2c288e 100644
--- a/sc/CppunitTest_sc_datapilottableobj.mk
+++ b/sc/CppunitTest_sc_datapilottableobj.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_datapilottableobj,\
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
+ linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
diff --git a/sc/CppunitTest_sc_namedrangeobj.mk b/sc/CppunitTest_sc_namedrangeobj.mk
index 3b68504ac429..b18ba6c64569 100644
--- a/sc/CppunitTest_sc_namedrangeobj.mk
+++ b/sc/CppunitTest_sc_namedrangeobj.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_namedrangeobj,\
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
+ linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
diff --git a/sc/CppunitTest_sc_namedrangesobj.mk b/sc/CppunitTest_sc_namedrangesobj.mk
index 49d5f43f9f54..0b7c012c27ce 100644
--- a/sc/CppunitTest_sc_namedrangesobj.mk
+++ b/sc/CppunitTest_sc_namedrangesobj.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_namedrangesobj,\
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
+ linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
diff --git a/sc/CppunitTest_sc_tablesheetobj.mk b/sc/CppunitTest_sc_tablesheetobj.mk
index ef212c33574f..c4347c083a9d 100644
--- a/sc/CppunitTest_sc_tablesheetobj.mk
+++ b/sc/CppunitTest_sc_tablesheetobj.mk
@@ -74,6 +74,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_tablesheetobj,\
framework/util/fwk \
i18npool/source/search/i18nsearch \
i18npool/util/i18npool \
+ linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index 415292bd2a26..a195db529d71 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -31,6 +31,7 @@
#include <unotools/syslocaleoptions.hxx>
#include <osl/file.hxx>
#include <unotools/tempfile.hxx>
+#include <vcl/scheduler.hxx>
#include <isheadless.hxx>
@@ -104,6 +105,10 @@ void test::BootstrapFixture::setUp()
test::BootstrapFixtureBase::setUp();
test_init_impl(m_bAssertOnDialog, m_bNeedUCB, m_xSFactory.get());
+
+#if OSL_DEBUG_LEVEL > 0
+ Scheduler::ProcessEventsToIdle();
+#endif
}
test::BootstrapFixture::~BootstrapFixture()
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 5c1b1bc8f5f4..8fd26ec79a55 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -105,7 +105,8 @@ void Scheduler::ImplDeInitScheduler()
++nTasks;
pSchedulerData = pSchedulerData->mpNext;
}
- SAL_INFO( "vcl.schedule.deinit", "DeInit the scheduler - tasks: " << nTasks );
+ SAL_INFO( "vcl.schedule.deinit",
+ "DeInit the scheduler - pending tasks: " << nTasks );
}
// clean up all the sfx::SfxItemDisruptor_Impl Idles
commit f4cbd31465d3737855e694b7341fb3bc063d63c4
Author: Serge Krot <Serge.Krot at cib.de>
Date: Wed Oct 4 09:45:53 2017 +0200
related tdf#66398 remove useless breaks
Change-Id: I39caad06bcd645d582c180195a839113759b57a1
Reviewed-on: https://gerrit.libreoffice.org/43159
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py
index 2168fff556d7..3605892fe71f 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -25,7 +25,7 @@ def createFastChildContextFromFactory(model):
(OOXMLFastContextHandler* pHandler, OOXMLFactory_ns::Pointer_t pFactory, Token_t Element)
{
uno::Reference <xml::sax::XFastContextHandler> aResult;
- Id nDefine = pHandler->getDefine();
+ const Id nDefine = pHandler->getDefine();
if (pFactory.get() != NULL)
{
@@ -33,7 +33,7 @@ def createFastChildContextFromFactory(model):
Id nElementId;
if (pFactory->getElementId(nDefine, Element, nResource, nElementId))
{
- Id nId = pFactory->getResourceId(nDefine, Element);
+ const Id nId = pFactory->getResourceId(nDefine, Element);
switch (nResource)
{""")
@@ -108,7 +108,6 @@ def fastTokenToId(model):
print("""
std::string fastTokenToId(sal_uInt32 nToken)
{
-
std::string sResult;
#ifdef DEBUG_WRITERFILTER
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py b/writerfilter/source/ooxml/factoryimpl_ns.py
index 1134a14cb331..54e3b8c9060a 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -235,7 +235,6 @@ def printValueData(values):
output_else = "else "
print(" else { return false; }")
print(" return true;")
- print(" break;")
print(" }")
@@ -258,7 +257,6 @@ def factoryGetListValue(nsNode):
appendValueData(values, valueData, idToLabel(valueNode.getAttribute("tokenid")))
printValueData(values)
print(" return false;")
- print(" break;")
print(""" default:
break;
@@ -376,7 +374,6 @@ def factoryCreateElementMap(files, nsNode):
print(" default: return false;")
print(" }")
print(" return true;")
- print(" break;")
print(" default:")
print(" switch (nId)")
print(" {")
@@ -384,10 +381,7 @@ def factoryCreateElementMap(files, nsNode):
print(""" default: return false;
}
return true;
- break;
}
-
- return false;
}
""")
commit 4054051cd5aee8cbc6cd2b3384b4ab3d6b6a6ace
Author: Serge Krot <Serge.Krot at cib.de>
Date: Mon Oct 2 17:51:24 2017 +0200
tdf#66398 Do not output document protection in docx twice
Change-Id: I16a5f2d3b8ef59e6edfdecd9d2bd19a2c10c80ea
Reviewed-on: https://gerrit.libreoffice.org/43158
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 8e6b8d5cce21..4ecd04f7d425 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -965,6 +965,7 @@ void DocxExport::WriteSettings()
// Has themeFontLang information
uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW );
+ bool hasProtectionProperties = false;
uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
const OUString aGrabBagName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) )
@@ -1057,8 +1058,12 @@ void DocxExport::WriteSettings()
if (rAttributeList.getLength())
{
+ // we have document protection from from input DOCX file
+
sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
pFS->singleElementNS(XML_w, XML_documentProtection, xAttributeList);
+
+ hasProtectionProperties = true;
}
}
}
@@ -1066,13 +1071,18 @@ void DocxExport::WriteSettings()
// Protect form
// Section-specific write protection
- if (m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) ||
- m_pSections->DocumentIsProtected())
+ if (! hasProtectionProperties)
{
- pFS->singleElementNS(XML_w, XML_documentProtection,
- FSNS(XML_w, XML_edit), "forms",
- FSNS(XML_w, XML_enforcement), "true",
- FSEND);
+ if (m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) ||
+ m_pSections->DocumentIsProtected())
+ {
+ // we have form protection from Writer or from input ODT file
+
+ pFS->singleElementNS(XML_w, XML_documentProtection,
+ FSNS(XML_w, XML_edit), "forms",
+ FSNS(XML_w, XML_enforcement), "true",
+ FSEND);
+ }
}
// finish settings.xml
commit 40f627c28deb9c7eacd77c4a2c4e2eb919d5cf88
Author: Serge Krot <Serge.Krot at cib.de>
Date: Mon Oct 2 17:40:59 2017 +0200
tdf#66398 Remove double initialization of the form protection
Change-Id: I639523b55aef1914ddec62aaae44b0dc87346d0b
Reviewed-on: https://gerrit.libreoffice.org/43157
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index b76c121bb0d2..8e6b8d5cce21 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -931,12 +931,6 @@ void DocxExport::WriteSettings()
pFS->singleElementNS( XML_w, XML_defaultTabStop, FSNS( XML_w, XML_val ),
OString::number( m_aSettings.defaultTabStop).getStr(), FSEND );
- // Protect form
- if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ))
- {
- pFS->singleElementNS( XML_w, XML_documentProtection, FSNS(XML_w, XML_edit), "forms", FSNS(XML_w, XML_enforcement), "1", FSEND );
- }
-
// Do not justify lines with manual break
if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK ))
{
@@ -1070,14 +1064,18 @@ void DocxExport::WriteSettings()
}
}
+ // Protect form
// Section-specific write protection
- if ( m_pSections->DocumentIsProtected() )
+ if (m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) ||
+ m_pSections->DocumentIsProtected())
{
- pFS->singleElementNS( XML_w, XML_documentProtection,
- FSNS( XML_w, XML_enforcement ), "true",
- FSNS( XML_w, XML_edit ), "forms",
- FSEND );
+ pFS->singleElementNS(XML_w, XML_documentProtection,
+ FSNS(XML_w, XML_edit), "forms",
+ FSNS(XML_w, XML_enforcement), "true",
+ FSEND);
}
+
+ // finish settings.xml
pFS->endElementNS( XML_w, XML_settings );
}
commit ce057e662b2e10e111353e9461c3c01434ddbb0f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 6 18:26:15 2017 +0200
Revert "Fix -fsanitize=signed-integer-overflow"
This reverts commit 63d845dc88690b9c5c8194e1512a8e4390c7ee24. The immediate
problem is fixed with 9dd0c0fcc141ae53cacb29cd0b144ac2b13e9f86 "Missing
dependency" now. For the general issue that loading
sw/qa/extras/uiwriter/data/tdf112860.fodt fails with a UBSan error or a null
deref SIGSEGV when fonts are missing see
<https://bugs.documentfoundation.org/show_bug.cgi?id=112942>
"SwUiWriterTest::testTdf112860 crashes when Liberation fonts are missing".
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index c51c379b89cf..6673ed22b909 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -17,9 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <sal/config.h>
-
-#include <o3tl/safeint.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
#include <drawdoc.hxx>
@@ -107,7 +104,7 @@ static SwRectFnCollection aHorizontal = {
&FirstMinusSecond,
&FirstMinusSecond,
&SwIncrement,
- &o3tl::saturating_add<long>,
+ &SwIncrement,
&SwRect::SetLeftAndWidth,
&SwRect::SetTopAndHeight
};
commit 9dd0c0fcc141ae53cacb29cd0b144ac2b13e9f86
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 6 18:09:22 2017 +0200
Missing dependency
external/more_fonts/ExternalPackage_liberation.mk not installed caused
SwUiWriterTest::testTdf112860 (sw/qa/extras/uiwriter/uiwriter.cxx) to fail, see
63d845dc88690b9c5c8194e1512a8e4390c7ee24 "Fix -fsanitize=signed-integer-
overflow"
Change-Id: Ied4dcf9cfe167e741c3bb0c1f4fe853cb44b0d2b
diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk
index 34eb38c0087d..b657e1999e6c 100644
--- a/sw/CppunitTest_sw_uiwriter.mk
+++ b/sw/CppunitTest_sw_uiwriter.mk
@@ -65,4 +65,9 @@ $(eval $(call gb_CppunitTest_use_uiconfigs,sw_uiwriter, \
$(call gb_CppunitTest_get_target,sw_uiwriter): \
$(call gb_Library_get_target,textconv_dict)
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
+$(call gb_CppunitTest_get_target,sw_uiwriter): \
+ $(call gb_ExternalPackage_get_target,fonts_liberation)
+endif
+
# vim: set noet sw=4 ts=4:
commit 3035a8066ffc7120bb6a6da2c50d5b032611bb90
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Oct 6 14:10:00 2017 +0200
use rtl::Reference in SvXMLEmbeddedObjectHelper
instead of manual ref-counting
Change-Id: I559ebb3871dd3dd4a160bd83a259e36dd2f7b4d6
Reviewed-on: https://gerrit.libreoffice.org/43200
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svx/xmleohlp.hxx b/include/svx/xmleohlp.hxx
index 51227dbb8b0d..8d93889e3723 100644
--- a/include/svx/xmleohlp.hxx
+++ b/include/svx/xmleohlp.hxx
@@ -99,11 +99,11 @@ public:
::comphelper::IEmbeddedHelper& rDocPersist,
SvXMLEmbeddedObjectHelperMode eCreateMode );
- static SvXMLEmbeddedObjectHelper* Create(
+ static rtl::Reference<SvXMLEmbeddedObjectHelper> Create(
const css::uno::Reference < css::embed::XStorage >&,
::comphelper::IEmbeddedHelper& rDocPersist,
SvXMLEmbeddedObjectHelperMode eCreateMode );
- static SvXMLEmbeddedObjectHelper* Create(
+ static rtl::Reference<SvXMLEmbeddedObjectHelper> Create(
::comphelper::IEmbeddedHelper& rDocPersist,
SvXMLEmbeddedObjectHelperMode eCreateMode );
static void Destroy( SvXMLEmbeddedObjectHelper* pSvXMLEmbeddedObjectHelper );
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index a2a746474283..d26f42962e44 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1340,9 +1340,7 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(_xStorageToSaveTo,SvXMLGraphicHelperMode::Write);
xGrfResolver = pGraphicHelper;
pGraphicHelper->release();
- SvXMLEmbeddedObjectHelper* pEmbeddedObjectHelper = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, SvXMLEmbeddedObjectHelperMode::Write );
- xObjectResolver = pEmbeddedObjectHelper;
- pEmbeddedObjectHelper->release();
+ xObjectResolver = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, SvXMLEmbeddedObjectHelperMode::Write ).get();
aDelegatorArguments.realloc(nArgsLen+2);
aDelegatorArguments[nArgsLen++] <<= xGrfResolver;
@@ -2036,7 +2034,7 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWith
aValue.Value >>= xStorage;
}
m_pImpl->m_pObjectContainer->SwitchPersistence(xStorage);
- xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, SvXMLEmbeddedObjectHelperMode::Read ));
+ xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, SvXMLEmbeddedObjectHelperMode::Read ).get());
}
return xRet;
}
@@ -2123,9 +2121,9 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( co
return m_pImpl->m_xMarkerTable;
}
else if ( aServiceSpecifier == "com.sun.star.document.ImportEmbeddedObjectResolver" )
- return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, SvXMLEmbeddedObjectHelperMode::Read ));
+ return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, SvXMLEmbeddedObjectHelperMode::Read ).get());
else if ( aServiceSpecifier == "com.sun.star.document.ExportEmbeddedObjectResolver" )
- return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, SvXMLEmbeddedObjectHelperMode::Write ));
+ return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, SvXMLEmbeddedObjectHelperMode::Write ).get());
else if ( aServiceSpecifier == "com.sun.star.document.ImportGraphicObjectResolver" )
{
SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,SvXMLGraphicHelperMode::Write);
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 2b4560480499..7e35690aed86 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -434,19 +434,19 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError )
SAL_INFO( "sc.filter", "meta import end" );
}
- SvXMLGraphicHelper* pGraphicHelper = nullptr;
+ rtl::Reference<SvXMLGraphicHelper> xGraphicHelper;
uno::Reference< document::XGraphicObjectResolver > xGrfContainer;
uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
- SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
if( xStorage.is() )
{
- pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, SvXMLGraphicHelperMode::Read );
- xGrfContainer = pGraphicHelper;
+ xGraphicHelper = SvXMLGraphicHelper::Create( xStorage, SvXMLGraphicHelperMode::Read );
+ xGrfContainer = xGraphicHelper.get();
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create(xStorage, mrDocShell, SvXMLEmbeddedObjectHelperMode::Read);
- xObjectResolver = pObjectHelper;
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create(xStorage, mrDocShell, SvXMLEmbeddedObjectHelperMode::Read);
+ xObjectResolver = xObjectHelper.get();
}
uno::Sequence<uno::Any> aStylesArgs(4);
uno::Any* pStylesArgs = aStylesArgs.getArray();
@@ -515,11 +515,13 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError )
SAL_INFO( "sc.filter", "content import end" );
}
- if( pGraphicHelper )
- SvXMLGraphicHelper::Destroy( pGraphicHelper );
+ if( xGraphicHelper.is() )
+ xGraphicHelper->dispose();
+ xGraphicHelper.clear();
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ if( xObjectHelper.is() )
+ xObjectHelper->dispose();
+ xObjectHelper.clear();
if (xStatusIndicator.is())
xStatusIndicator->end();
@@ -862,7 +864,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
}
uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
- SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
uno::Reference< document::XGraphicObjectResolver > xGrfContainer;
SvXMLGraphicHelper* pGraphicHelper = nullptr;
@@ -875,8 +877,8 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
if( pObjSh )
{
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *pObjSh, SvXMLEmbeddedObjectHelperMode::Write );
- xObjectResolver = pObjectHelper;
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *pObjSh, SvXMLEmbeddedObjectHelperMode::Write );
+ xObjectResolver = xObjectHelper.get();
}
// styles export
@@ -929,8 +931,9 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
if( pGraphicHelper )
SvXMLGraphicHelper::Destroy( pGraphicHelper );
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ if( xObjectHelper )
+ xObjectHelper->dispose();
+ xObjectHelper.clear();
// settings export
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 405ad7595ce6..00b61eb92859 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -509,7 +509,7 @@ bool SdXMLFilter::Import( ErrCode& nError )
Reference< document::XGraphicObjectResolver > xGraphicResolver;
SvXMLGraphicHelper *pGraphicHelper = nullptr;
Reference< document::XEmbeddedObjectResolver > xObjectResolver;
- SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
Reference< lang::XComponent > xModelComp( mxModel, uno::UNO_QUERY );
@@ -560,10 +560,10 @@ bool SdXMLFilter::Import( ErrCode& nError )
SvXMLGraphicHelperMode::Read,
false );
xGraphicResolver = pGraphicHelper;
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create(
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create(
xStorage, *pDoc->GetPersist(),
SvXMLEmbeddedObjectHelperMode::Read );
- xObjectResolver = pObjectHelper;
+ xObjectResolver = xObjectHelper.get();
}
// Set base URI
@@ -652,8 +652,9 @@ bool SdXMLFilter::Import( ErrCode& nError )
if( pGraphicHelper )
SvXMLGraphicHelper::Destroy( pGraphicHelper );
xGraphicResolver = nullptr;
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ if( xObjectHelper.is() )
+ xObjectHelper->dispose();
+ xObjectHelper.clear();
xObjectResolver = nullptr;
if( mxStatusIndicator.is() )
@@ -783,7 +784,7 @@ bool SdXMLFilter::Import( ErrCode& nError )
bool SdXMLFilter::Export()
{
- SvXMLEmbeddedObjectHelper* pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
SvXMLGraphicHelper* pGraphicHelper = nullptr;
bool bDocRet = false;
@@ -874,8 +875,8 @@ bool SdXMLFilter::Export()
// create helper for graphic and ole export if we have a storage
if( xStorage.is() )
{
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *mrDocShell.GetDoc()->GetPersist(), SvXMLEmbeddedObjectHelperMode::Write );
- xObjectResolver = pObjectHelper;
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *mrDocShell.GetDoc()->GetPersist(), SvXMLEmbeddedObjectHelperMode::Write );
+ xObjectResolver = xObjectHelper.get();
pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, SvXMLGraphicHelperMode::Write, false );
xGrfResolver = pGraphicHelper;
@@ -999,8 +1000,9 @@ bool SdXMLFilter::Export()
if( pGraphicHelper )
SvXMLGraphicHelper::Destroy( pGraphicHelper );
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ if( xObjectHelper )
+ xObjectHelper->dispose();
+ xObjectHelper.clear();
return bDocRet;
}
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 636e5458500c..4c5a4469136d 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -71,7 +71,7 @@ public:
, nState(-1)
{}
- static EmbedEventListener_Impl* Create( EmbeddedObjectRef* );
+ static rtl::Reference<EmbedEventListener_Impl> Create( EmbeddedObjectRef* );
virtual void SAL_CALL changingState( const lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) override;
virtual void SAL_CALL stateChanged( const lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) override;
@@ -82,23 +82,22 @@ public:
virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
};
-EmbedEventListener_Impl* EmbedEventListener_Impl::Create( EmbeddedObjectRef* p )
+rtl::Reference<EmbedEventListener_Impl> EmbedEventListener_Impl::Create( EmbeddedObjectRef* p )
{
- EmbedEventListener_Impl* pRet = new EmbedEventListener_Impl( p );
- pRet->acquire();
+ rtl::Reference<EmbedEventListener_Impl> pRet(new EmbedEventListener_Impl( p ));
if ( p->GetObject().is() )
{
- p->GetObject()->addStateChangeListener( pRet );
+ p->GetObject()->addStateChangeListener( pRet.get() );
uno::Reference < util::XCloseable > xClose( p->GetObject(), uno::UNO_QUERY );
DBG_ASSERT( xClose.is(), "Object does not support XCloseable!" );
if ( xClose.is() )
- xClose->addCloseListener( pRet );
+ xClose->addCloseListener( pRet.get() );
uno::Reference < document::XEventBroadcaster > xBrd( p->GetObject(), uno::UNO_QUERY );
if ( xBrd.is() )
- xBrd->addEventListener( pRet );
+ xBrd->addEventListener( pRet.get() );
pRet->nState = p->GetObject()->getCurrentState();
if ( pRet->nState == embed::EmbedStates::RUNNING )
@@ -106,7 +105,7 @@ EmbedEventListener_Impl* EmbedEventListener_Impl::Create( EmbeddedObjectRef* p )
uno::Reference < util::XModifiable > xMod( p->GetObject()->getComponent(), uno::UNO_QUERY );
if ( xMod.is() )
// listen for changes in running state (update replacements in case of changes)
- xMod->addModifyListener( pRet );
+ xMod->addModifyListener( pRet.get() );
}
}
@@ -221,7 +220,7 @@ struct EmbeddedObjectRef_Impl
{
uno::Reference <embed::XEmbeddedObject> mxObj;
- EmbedEventListener_Impl* xListener;
+ rtl::Reference<EmbedEventListener_Impl> mxListener;
OUString aPersistName;
OUString aMediaType;
comphelper::EmbeddedObjectContainer* pContainer;
@@ -235,7 +234,6 @@ struct EmbeddedObjectRef_Impl
awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member
EmbeddedObjectRef_Impl() :
- xListener(nullptr),
pContainer(nullptr),
pGraphic(nullptr),
nViewAspect(embed::Aspects::MSOLE_CONTENT),
@@ -247,7 +245,6 @@ struct EmbeddedObjectRef_Impl
EmbeddedObjectRef_Impl( const EmbeddedObjectRef_Impl& r ) :
mxObj(r.mxObj),
- xListener(nullptr),
aPersistName(r.aPersistName),
aMediaType(r.aMediaType),
pContainer(r.pContainer),
@@ -280,13 +277,13 @@ EmbeddedObjectRef::EmbeddedObjectRef( const uno::Reference < embed::XEmbeddedObj
{
mpImpl->nViewAspect = nAspect;
mpImpl->mxObj = xObj;
- mpImpl->xListener = EmbedEventListener_Impl::Create( this );
+ mpImpl->mxListener = EmbedEventListener_Impl::Create( this );
}
EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj ) :
mpImpl(new EmbeddedObjectRef_Impl(*rObj.mpImpl))
{
- mpImpl->xListener = EmbedEventListener_Impl::Create( this );
+ mpImpl->mxListener = EmbedEventListener_Impl::Create( this );
}
EmbeddedObjectRef::~EmbeddedObjectRef()
@@ -301,7 +298,7 @@ void EmbeddedObjectRef::Assign( const uno::Reference < embed::XEmbeddedObject >&
Clear();
mpImpl->nViewAspect = nAspect;
mpImpl->mxObj = xObj;
- mpImpl->xListener = EmbedEventListener_Impl::Create( this );
+ mpImpl->mxListener = EmbedEventListener_Impl::Create( this );
//#i103460#
if ( IsChart() )
@@ -315,17 +312,17 @@ void EmbeddedObjectRef::Assign( const uno::Reference < embed::XEmbeddedObject >&
void EmbeddedObjectRef::Clear()
{
- if (mpImpl->mxObj.is() && mpImpl->xListener)
+ if (mpImpl->mxObj.is() && mpImpl->mxListener.is())
{
- mpImpl->mxObj->removeStateChangeListener(mpImpl->xListener);
+ mpImpl->mxObj->removeStateChangeListener(mpImpl->mxListener.get());
uno::Reference<util::XCloseable> xClose(mpImpl->mxObj, uno::UNO_QUERY);
if ( xClose.is() )
- xClose->removeCloseListener( mpImpl->xListener );
+ xClose->removeCloseListener( mpImpl->mxListener.get() );
uno::Reference<document::XEventBroadcaster> xBrd(mpImpl->mxObj, uno::UNO_QUERY);
if ( xBrd.is() )
- xBrd->removeEventListener( mpImpl->xListener );
+ xBrd->removeEventListener( mpImpl->mxListener.get() );
if ( mpImpl->bIsLocked )
{
@@ -348,11 +345,10 @@ void EmbeddedObjectRef::Clear()
}
}
- if (mpImpl->xListener)
+ if (mpImpl->mxListener.is())
{
- mpImpl->xListener->pObject = nullptr;
- mpImpl->xListener->release();
- mpImpl->xListener = nullptr;
+ mpImpl->mxListener->pObject = nullptr;
+ mpImpl->mxListener.clear();
}
mpImpl->mxObj = nullptr;
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index 7f821cc6aad9..c349ef624bdb 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -543,41 +543,29 @@ void SvXMLEmbeddedObjectHelper::Init(
meCreateMode = eCreateMode;
}
-SvXMLEmbeddedObjectHelper* SvXMLEmbeddedObjectHelper::Create(
+rtl::Reference<SvXMLEmbeddedObjectHelper> SvXMLEmbeddedObjectHelper::Create(
const uno::Reference < embed::XStorage >& rRootStorage,
::comphelper::IEmbeddedHelper& rDocPersist,
SvXMLEmbeddedObjectHelperMode eCreateMode )
{
- SvXMLEmbeddedObjectHelper* pThis = new SvXMLEmbeddedObjectHelper;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> pThis(new SvXMLEmbeddedObjectHelper);
- pThis->acquire();
pThis->Init( rRootStorage, rDocPersist, eCreateMode );
return pThis;
}
-SvXMLEmbeddedObjectHelper* SvXMLEmbeddedObjectHelper::Create(
+rtl::Reference<SvXMLEmbeddedObjectHelper> SvXMLEmbeddedObjectHelper::Create(
::comphelper::IEmbeddedHelper& rDocPersist,
SvXMLEmbeddedObjectHelperMode eCreateMode )
{
- SvXMLEmbeddedObjectHelper* pThis = new SvXMLEmbeddedObjectHelper;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> pThis(new SvXMLEmbeddedObjectHelper);
- pThis->acquire();
pThis->Init( nullptr, rDocPersist, eCreateMode );
return pThis;
}
-void SvXMLEmbeddedObjectHelper::Destroy(
- SvXMLEmbeddedObjectHelper* pSvXMLEmbeddedObjectHelper )
-{
- if( pSvXMLEmbeddedObjectHelper )
- {
- pSvXMLEmbeddedObjectHelper->dispose();
- pSvXMLEmbeddedObjectHelper->release();
- }
-}
-
// XGraphicObjectResolver: alien objects!
OUString SAL_CALL SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL(const OUString& rURL)
{
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index 0d827a29b6c7..be47ff334b92 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -56,7 +56,7 @@ bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputSt
SvXMLGraphicHelper *pGraphicHelper = nullptr;
Reference< document::XEmbeddedObjectResolver > xObjectResolver;
- SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
Reference< lang::XComponent > xSourceDoc( xComponent );
try
@@ -76,8 +76,8 @@ bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputSt
::comphelper::IEmbeddedHelper *pPersist = pModel->GetPersist();
if( pPersist )
{
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create( *pPersist, SvXMLEmbeddedObjectHelperMode::Write );
- xObjectResolver = pObjectHelper;
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create( *pPersist, SvXMLEmbeddedObjectHelperMode::Write );
+ xObjectResolver = xObjectHelper.get();
}
pGraphicHelper = SvXMLGraphicHelper::Create( SvXMLGraphicHelperMode::Write );
@@ -128,9 +128,8 @@ bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputSt
SvXMLGraphicHelper::Destroy( pGraphicHelper );
xGraphicResolver = nullptr;
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
- xObjectResolver = nullptr;
+ if( xObjectHelper.is() )
+ xObjectHelper->dispose();
return bDocRet;
}
@@ -156,7 +155,7 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
SvXMLGraphicHelper *pGraphicHelper = nullptr;
Reference< document::XEmbeddedObjectResolver > xObjectResolver;
- SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
Reference< lang::XComponent > xTargetDocument( xComponent );
if( !xTargetDocument.is() )
@@ -182,10 +181,10 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
::comphelper::IEmbeddedHelper *pPersist = pModel->GetPersist();
if( pPersist )
{
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create(
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create(
*pPersist,
SvXMLEmbeddedObjectHelperMode::Read );
- xObjectResolver = pObjectHelper;
+ xObjectResolver = xObjectHelper.get();
}
// parse
@@ -231,8 +230,9 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
SvXMLGraphicHelper::Destroy( pGraphicHelper );
xGraphicResolver = nullptr;
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ if( xObjectHelper.is() )
+ xObjectHelper->dispose();
+ xObjectHelper.clear();
xObjectResolver = nullptr;
if ( xTargetModel.is() )
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index bb42dffa51e6..6ddeb64b8f3e 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -476,7 +476,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
SvXMLGraphicHelper *pGraphicHelper = nullptr;
uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
- SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
// get the input stream (storage or stream)
uno::Reference<embed::XStorage> xStorage;
@@ -495,10 +495,10 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
SfxObjectShell *pPersist = rDoc.GetPersist();
if( pPersist )
{
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create(
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create(
xStorage, *pPersist,
SvXMLEmbeddedObjectHelperMode::Read );
- xObjectResolver = pObjectHelper;
+ xObjectResolver = xObjectHelper.get();
}
// Get the docshell, the model, and finally the model's component
@@ -891,8 +891,9 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
if( pGraphicHelper )
SvXMLGraphicHelper::Destroy( pGraphicHelper );
xGraphicResolver = nullptr;
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ if( xObjectHelper )
+ xObjectHelper->dispose();
+ xObjectHelper.clear();
xObjectResolver = nullptr;
aHoldRef.clear();
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 00562c6f7a25..e7469aec35dc 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -82,7 +82,7 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
SvXMLGraphicHelper *pGraphicHelper = nullptr;
uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
- SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
OSL_ENSURE( xStg.is(), "Where is my storage?" );
pGraphicHelper = SvXMLGraphicHelper::Create( xStg,
@@ -93,10 +93,10 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
SfxObjectShell *pPersist = pDoc->GetPersist();
if( pPersist )
{
- pObjectHelper = SvXMLEmbeddedObjectHelper::Create(
+ xObjectHelper = SvXMLEmbeddedObjectHelper::Create(
xStg, *pPersist,
SvXMLEmbeddedObjectHelperMode::Write );
- xObjectResolver = pObjectHelper;
+ xObjectResolver = xObjectHelper.get();
}
// create and prepare the XPropertySet that gets passed through
@@ -392,8 +392,9 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
SvXMLGraphicHelper::Destroy( pGraphicHelper );
xGraphicResolver = nullptr;
- if( pObjectHelper )
- SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ if( xObjectHelper )
+ xObjectHelper->dispose();
+ xObjectHelper.clear();
xObjectResolver = nullptr;
// restore redline mode
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index d4827e1ba4b6..7838281e699c 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -246,17 +246,16 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
SetGraphicResolver( xGraphicResolver );
}
- SvXMLEmbeddedObjectHelper *pEmbeddedResolver = nullptr;
+ rtl::Reference<SvXMLEmbeddedObjectHelper> xEmbeddedResolver;
if( !GetEmbeddedResolver().is() )
{
SfxObjectShell *pPersist = pDoc->GetPersist();
if( pPersist )
{
- pEmbeddedResolver = SvXMLEmbeddedObjectHelper::Create(
+ xEmbeddedResolver = SvXMLEmbeddedObjectHelper::Create(
*pPersist,
SvXMLEmbeddedObjectHelperMode::Write );
- Reference< XEmbeddedObjectResolver > xEmbeddedResolver( pEmbeddedResolver );
- SetEmbeddedResolver( xEmbeddedResolver );
+ SetEmbeddedResolver( Reference<XEmbeddedObjectResolver>( xEmbeddedResolver.get() ) );
}
}
@@ -296,8 +295,9 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
if( pGraphicResolver )
SvXMLGraphicHelper::Destroy( pGraphicResolver );
- if( pEmbeddedResolver )
- SvXMLEmbeddedObjectHelper::Destroy( pEmbeddedResolver );
+ if( xEmbeddedResolver )
+ xEmbeddedResolver->dispose();
+ xEmbeddedResolver.clear();
OSL_ENSURE( !m_pTableLines, "there are table columns infos left" );
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 6e1d0e70e1f6..03e0edaac60f 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -395,7 +395,6 @@ SwXMLImport::SwXMLImport(
m_pTableElemTokenMap( nullptr ),
m_pTableCellAttrTokenMap( nullptr ),
m_pGraphicResolver( nullptr ),
- m_pEmbeddedResolver( nullptr ),
m_nStyleFamilyMask( SfxStyleFamily::All ),
m_bLoadDoc( true ),
m_bInsert( false ),
@@ -673,10 +672,10 @@ void SwXMLImport::startDocument()
SfxObjectShell *pPersist = pDoc->GetPersist();
if( pPersist )
{
- m_pEmbeddedResolver = SvXMLEmbeddedObjectHelper::Create(
+ m_xEmbeddedResolver = SvXMLEmbeddedObjectHelper::Create(
*pPersist,
SvXMLEmbeddedObjectHelperMode::Read );
- Reference< document::XEmbeddedObjectResolver > xEmbeddedResolver( m_pEmbeddedResolver );
+ Reference< document::XEmbeddedObjectResolver > xEmbeddedResolver( m_xEmbeddedResolver.get() );
SetEmbeddedResolver( xEmbeddedResolver );
}
}
@@ -693,8 +692,9 @@ void SwXMLImport::endDocument()
if( m_pGraphicResolver )
SvXMLGraphicHelper::Destroy( m_pGraphicResolver );
- if( m_pEmbeddedResolver )
- SvXMLEmbeddedObjectHelper::Destroy( m_pEmbeddedResolver );
+ if( m_xEmbeddedResolver )
+ m_xEmbeddedResolver->dispose();
+ m_xEmbeddedResolver.clear();
// Clear the shape import to sort the shapes (and not in the
// destructor that might be called after the import has finished
// for Java filters.
diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx
index 769efa031b5e..1afa89ac1650 100644
--- a/sw/source/filter/xml/xmlimp.hxx
+++ b/sw/source/filter/xml/xmlimp.hxx
@@ -69,7 +69,8 @@ class SwXMLImport: public SvXMLImport
SvXMLTokenMap *m_pTableElemTokenMap;
SvXMLTokenMap *m_pTableCellAttrTokenMap;
SvXMLGraphicHelper *m_pGraphicResolver;
- SvXMLEmbeddedObjectHelper *m_pEmbeddedResolver;
+ rtl::Reference<SvXMLEmbeddedObjectHelper>
+ m_xEmbeddedResolver;
SvXMLItemMapEntriesRef m_xTableItemMap;
SvXMLItemMapEntriesRef m_xTableColItemMap;
commit 0d24dd25e6f506b5f9128d70d7eb21f0bb4dde89
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Oct 5 18:19:32 2017 +0200
KDE update system loop integration
This updates the system loop integration to be on par with the
other backends. This includes:
1. Process LO user events before other LO events
2. Correctly handle elapsed QTimer events
3. Don't wait-yield in the main thread from a non-main thread
Change-Id: Ia17be032ae39dc4c7bfa44cadd22d85a1b9c4fbd
Reviewed-on: https://gerrit.libreoffice.org/43198
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/inc/unx/gendisp.hxx b/vcl/inc/unx/gendisp.hxx
index 5c8f5113c300..2d5bc12fcadf 100644
--- a/vcl/inc/unx/gendisp.hxx
+++ b/vcl/inc/unx/gendisp.hxx
@@ -47,7 +47,7 @@ public:
void SendInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent = SalEvent::UserEvent );
void CancelInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent );
- bool DispatchInternalEvent();
+ bool DispatchInternalEvent( bool bHandleAllCurrentEvent = false );
bool MouseCaptured( const SalFrame *pFrameData ) const
{ return m_pCapture == pFrameData; }
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 8f96e03630b0..54799149e25c 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -179,7 +179,7 @@ public:
virtual void StartTimer( sal_uLong nMS );
virtual void StopTimer();
- bool CheckTimeout( bool bExecuteTimers = true );
+ virtual bool CheckTimeout( bool bExecuteTimers = true );
SalI18N_InputMethod* GetInputMethod() const { return m_pInputMethod; }
Display* GetDisplay() const { return m_pDisplay; }
diff --git a/vcl/source/app/salusereventlist.cxx b/vcl/source/app/salusereventlist.cxx
index 6384d8805be4..8f9d76ed313f 100644
--- a/vcl/source/app/salusereventlist.cxx
+++ b/vcl/source/app/salusereventlist.cxx
@@ -51,6 +51,7 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents )
{
osl::MutexGuard aGuard( m_aUserEventsMutex );
+ assert( m_aProcessingUserEvents.empty() );
if( ! m_aUserEvents.empty() )
{
if( bHandleAllCurrentEvents )
diff --git a/vcl/unx/generic/app/gendisp.cxx b/vcl/unx/generic/app/gendisp.cxx
index 1be8606602e0..c83283a7b0e0 100644
--- a/vcl/unx/generic/app/gendisp.cxx
+++ b/vcl/unx/generic/app/gendisp.cxx
@@ -47,9 +47,9 @@ void SalGenericDisplay::emitDisplayChanged()
pAnyFrame->CallCallback( SalEvent::DisplayChanged, nullptr );
}
-bool SalGenericDisplay::DispatchInternalEvent()
+bool SalGenericDisplay::DispatchInternalEvent( bool bHandleAllCurrentEvent )
{
- return DispatchUserEvents( false );
+ return DispatchUserEvents( bHandleAllCurrentEvent );
}
void SalGenericDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent )
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index abd29a78c077..0d30e1d17a99 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -147,7 +147,8 @@ bool X11SalInstance::AnyInput(VclInputFlags nType)
if( (nType & VclInputFlags::TIMER) && (mpXLib && mpXLib->CheckTimeout(false)) )
bRet = true;
- else if (XPending(pDisplay) )
+
+ if( !bRet && XPending(pDisplay) )
{
PredicateReturn aInput;
XEvent aEvent;
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx
index 8a2422a3918d..14a753e1c0a1 100644
--- a/vcl/unx/kde4/KDESalDisplay.cxx
+++ b/vcl/unx/kde4/KDESalDisplay.cxx
@@ -47,9 +47,6 @@ SalKDEDisplay::~SalKDEDisplay()
void SalKDEDisplay::Yield()
{
- if( DispatchInternalEvent() )
- return;
-
// Prevent blocking from Drag'n'Drop events, which may have already have processed the event
if (XEventsQueued( pDisp_, QueuedAfterReading ) == 0)
return;
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index f047ed9fce65..43e055a2c0bb 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -53,6 +53,7 @@ KDEXLib::KDEXLib() :
m_nFakeCmdLineArgs( 0 ),
m_isGlibEventLoopType(false), m_allowKdeDialogs(false),
m_timerEventId( -1 ), m_postUserEventId( -1 )
+ , m_bTimedOut( false )
{
m_timerEventId = QEvent::registerEventType();
m_postUserEventId = QEvent::registerEventType();
@@ -269,22 +270,24 @@ void KDEXLib::socketNotifierActivated( int fd )
bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
+ bool bWasEvent = false;
if( !m_isGlibEventLoopType )
{
- bool wasEvent = false;
if( qApp->thread() == QThread::currentThread())
{
// even if we use the LO event loop, still process Qt's events,
// otherwise they can remain unhandled for quite a long while
- wasEvent = processYield( false, bHandleAllCurrentEvents );
+ bWasEvent = processYield( false, bHandleAllCurrentEvents );
}
- return SalXLib::Yield(bWait, bHandleAllCurrentEvents) || wasEvent;
+ return SalXLib::Yield(bWait, bHandleAllCurrentEvents) || bWasEvent;
}
// if we are the main thread (which is where the event processing is done),
// good, just do it
if( qApp->thread() == QThread::currentThread())
{
- return processYield( bWait, bHandleAllCurrentEvents );
+ bWasEvent = processYield( bWait, bHandleAllCurrentEvents );
+ if ( bWasEvent )
+ m_aWaitingYieldCond.set();
}
else
{
@@ -292,23 +295,40 @@ bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
// release the yield lock to prevent deadlock with the main thread
// (it's ok to release it here, since even normal processYield() would
// temporarily do it while checking for new events)
- SolarMutexReleaser aReleaser;
- return Q_EMIT processYieldSignal( bWait, bHandleAllCurrentEvents );
+ {
+ SolarMutexReleaser aReleaser;
+ bWasEvent = Q_EMIT processYieldSignal( false, bHandleAllCurrentEvents );
+ }
+ if ( !bWasEvent && bWait )
+ {
+ m_aWaitingYieldCond.reset();
+ SolarMutexReleaser aReleaser;
+ m_aWaitingYieldCond.wait();
+ bWasEvent = true;
+ }
}
+ return bWasEvent;
}
-/**
- * Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes
- * pending events that match flags until there are no more events to process.
- */
-bool KDEXLib::processYield( bool bWait, bool )
+bool KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents )
{
- QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
bool wasEvent = false;
- if ( bWait )
+ if ( m_isGlibEventLoopType )
+ {
+ wasEvent = SalKDEDisplay::self()->DispatchInternalEvent( bHandleAllCurrentEvents );
+ if ( !bHandleAllCurrentEvents && wasEvent )
+ return true;
+ }
+
+ /**
+ * Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes
+ * pending events that match flags until there are no more events to process.
+ */
+ QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
+ if ( bWait && !wasEvent )
wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents );
else
- wasEvent = dispatcher->processEvents( QEventLoop::AllEvents );
+ wasEvent = dispatcher->processEvents( QEventLoop::AllEvents ) || wasEvent;
return wasEvent;
}
@@ -336,18 +356,28 @@ void KDEXLib::StopTimer()
timeoutTimer.stop();
}
+bool KDEXLib::CheckTimeout( bool bExecuteTimers )
+{
+ if( !m_isGlibEventLoopType )
+ return SalXLib::CheckTimeout( bExecuteTimers );
+ assert( !bExecuteTimers );
+ return m_bTimedOut;
+}
+
void KDEXLib::timeoutActivated()
{
// don't potentially wait in timeout, as QTimer is non-recursive
+ m_bTimedOut = true;
QApplication::postEvent(this, new QEvent(QEvent::Type( m_timerEventId )));
}
void KDEXLib::customEvent(QEvent* e)
{
if( e->type() == m_timerEventId )
+ {
+ m_bTimedOut = false;
X11SalData::Timeout();
- else if( e->type() == m_postUserEventId )
- SalKDEDisplay::self()->DispatchInternalEvent();
+ }
}
void KDEXLib::Wakeup()
diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx
index 4c06104b4c59..452aae8b3286 100644
--- a/vcl/unx/kde4/KDEXLib.hxx
+++ b/vcl/unx/kde4/KDEXLib.hxx
@@ -30,13 +30,14 @@
#include <QtCore/QTimer>
#include <unx/salinst.h>
+#include <osl/conditn.hxx>
class VCLKDEApplication;
class KDEXLib : public QObject, public SalXLib
{
Q_OBJECT
- private:
+
bool m_bStartupDone;
std::unique_ptr<VCLKDEApplication> m_pApplication;
std::unique_ptr<char*[]> m_pFreeCmdLineArgs;
@@ -56,23 +57,24 @@ class KDEXLib : public QObject, public SalXLib
bool m_allowKdeDialogs;
int m_timerEventId;
int m_postUserEventId;
+ osl::Condition m_aWaitingYieldCond;
+ bool m_bTimedOut;
- private:
- void setupEventLoop();
+ void setupEventLoop();
- private Q_SLOTS:
+private Q_SLOTS:
void socketNotifierActivated( int fd );
void timeoutActivated();
void startTimeoutTimer();
- static bool processYield( bool bWait, bool bHandleAllCurrentEvents );
+ bool processYield( bool bWait, bool bHandleAllCurrentEvents );
- Q_SIGNALS:
+Q_SIGNALS:
void startTimeoutTimerSignal();
bool processYieldSignal( bool bWait, bool bHandleAllCurrentEvents );
css::uno::Reference< css::ui::dialogs::XFilePicker2 >
createFilePickerSignal( const css::uno::Reference< css::uno::XComponentContext >& );
- public:
+public:
KDEXLib();
virtual ~KDEXLib() override;
@@ -82,6 +84,7 @@ class KDEXLib : public QObject, public SalXLib
virtual void Remove( int fd ) override;
virtual void StartTimer( sal_uLong nMS ) override;
virtual void StopTimer() override;
+ virtual bool CheckTimeout( bool bExecuteTimers = true ) override;
virtual void Wakeup() override;
void TriggerUserEventProcessing();
@@ -90,7 +93,7 @@ class KDEXLib : public QObject, public SalXLib
virtual void customEvent(QEvent* e) override;
- public Q_SLOTS:
+public Q_SLOTS:
css::uno::Reference< css::ui::dialogs::XFilePicker2 >
createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& );
};
commit 53da556c600fa82ba84bc7fdce6a594b43f2b097
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Fri Oct 6 11:00:19 2017 +0200
Don't schedule the Idle job for busy documents
This refactors DocumentTimerManager to export the busy status
independent of the Idle function. This way it can be ignored in
the Scheduler while the document is busy,
Change-Id: Icec2075d3338ad8dd4440678eb0570d7fe887778
Reviewed-on: https://gerrit.libreoffice.org/43197
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/sw/inc/IDocumentTimerAccess.hxx b/sw/inc/IDocumentTimerAccess.hxx
index 717728f83c99..6efe1a114963 100644
--- a/sw/inc/IDocumentTimerAccess.hxx
+++ b/sw/inc/IDocumentTimerAccess.hxx
@@ -55,6 +55,11 @@ public:
*/
virtual void StartBackgroundJobs() = 0;
+ /**
+ * Is the document ready to be processed?
+ */
+ virtual bool IsDocIdle() const = 0;
+
protected:
virtual ~IDocumentTimerAccess() {};
};
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index b12d2f8d821b..7476a3665f20 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -223,9 +223,6 @@ namespace sfx2 {
void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
-// global function to start grammar checking in the document
-void StartGrammarChecking( SwDoc &rDoc );
-
using SwRubyList = std::vector<std::unique_ptr<SwRubyListEntry>>;
// Represents the model of a Writer document.
@@ -1630,6 +1627,12 @@ public:
rTable.end());
}
+ /**
+ * @param bSkipStart don't actually start the jobs, just check
+ * @returns true if new background checking jobs were started
+ */
+ bool StartGrammarChecking( bool bSkipStart = false );
+
private:
// Copies master header to left / first one, if necessary - used by ChgPageDesc().
void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst);
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx
index ec4874ea9ecc..5429c6edbda6 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -80,27 +80,16 @@ void DocumentTimerManager::StartBackgroundJobs()
maDocIdle.Start();
}
-IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
+DocumentTimerManager::IdleJob DocumentTimerManager::GetNextIdleJob() const
{
-#ifdef TIMELOG
- static ::rtl::Logfile* pModLogFile = 0;
- if( !pModLogFile )
- pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" );
-#endif
-
SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
if( pTmpRoot &&
!SfxProgress::GetActiveProgress( m_rDoc.GetDocShell() ) )
{
SwViewShell* pShell(m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell());
for(SwViewShell& rSh : pShell->GetRingContainer())
- {
if( rSh.ActionPend() )
- {
- pIdle->Start();
- return;
- }
- }
+ return IdleJob::Busy;
if( pTmpRoot->IsNeedGrammarCheck() )
{
@@ -109,59 +98,93 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
SvtLinguConfig().GetProperty( OUString(
UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar;
- if (bIsOnlineSpell && bIsAutoGrammar)
- StartGrammarChecking( m_rDoc );
+ if( bIsOnlineSpell && bIsAutoGrammar && m_rDoc.StartGrammarChecking( true ) )
+ return IdleJob::Grammar;
}
- std::set<SwRootFrame*> aAllLayouts = m_rDoc.GetAllLayouts();
- std::set<SwRootFrame*>::iterator pLayIter = aAllLayouts.begin();
- for ( ;pLayIter != aAllLayouts.end();++pLayIter )
+
+ for ( auto pLayout : m_rDoc.GetAllLayouts() )
{
- if ((*pLayIter)->IsIdleFormat())
- {
- (*pLayIter)->GetCurrShell()->LayoutIdle();
- // Defer the remaining work.
- pIdle->Start();
- return;
- }
+ if( pLayout->IsIdleFormat() )
+ return IdleJob::Layout;
}
SwFieldUpdateFlags nFieldUpdFlag = m_rDoc.GetDocumentSettingManager().getFieldUpdateFlags(true);
if( ( AUTOUPD_FIELD_ONLY == nFieldUpdFlag
- || AUTOUPD_FIELD_AND_CHARTS == nFieldUpdFlag ) &&
- m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsFieldsDirty()
- // If we switch the field name the Fields are not updated.
- // So the "background update" should always be carried out
- /* && !pStartSh->GetViewOptions()->IsFieldName()*/ )
+ || AUTOUPD_FIELD_AND_CHARTS == nFieldUpdFlag )
+ && m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsFieldsDirty() )
{
- if ( m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsInUpdateFields() ||
- m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() )
+ if( m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsInUpdateFields()
+ || m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() )
+ return IdleJob::Busy;
+ return IdleJob::Fields;
+ }
+ }
+
+ return IdleJob::None;
+}
+
+IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
+{
+#ifdef TIMELOG
+ static ::rtl::Logfile* pModLogFile = 0;
+ if( !pModLogFile )
+ pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" );
+#endif
+
+ IdleJob eJob = GetNextIdleJob();
+
+ switch ( eJob )
+ {
+ case IdleJob::Grammar:
+ m_rDoc.StartGrammarChecking();
+ break;
+
+ case IdleJob::Layout:
+ for ( auto pLayout : m_rDoc.GetAllLayouts() )
+ if( pLayout->IsIdleFormat() )
{
- pIdle->Start();
- return;
+ pLayout->GetCurrShell()->LayoutIdle();
+ break;
}
+ break;
- // Action brackets!
- m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( true );
+ case IdleJob::Fields:
+ {
+ SwViewShell* pShell( m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() );
+ SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
- pTmpRoot->StartAllAction();
+ // Action brackets!
+ m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( true );
- // no jump on update of fields #i85168#
- const bool bOldLockView = pShell->IsViewLocked();
- pShell->LockView( true );
+ pTmpRoot->StartAllAction();
- m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter )->ModifyNotification( nullptr, nullptr ); // ChapterField
- m_rDoc.getIDocumentFieldsAccess().UpdateExpFields( nullptr, false ); // Updates ExpressionFields
- m_rDoc.getIDocumentFieldsAccess().UpdateTableFields(nullptr); // Tables
- m_rDoc.getIDocumentFieldsAccess().UpdateRefFields(); // References
+ // no jump on update of fields #i85168#
+ const bool bOldLockView = pShell->IsViewLocked();
+ pShell->LockView( true );
- pTmpRoot->EndAllAction();
+ m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter )->ModifyNotification( nullptr, nullptr ); // ChapterField
+ m_rDoc.getIDocumentFieldsAccess().UpdateExpFields( nullptr, false ); // Updates ExpressionFields
+ m_rDoc.getIDocumentFieldsAccess().UpdateTableFields(nullptr); // Tables
+ m_rDoc.getIDocumentFieldsAccess().UpdateRefFields(); // References
- pShell->LockView( bOldLockView );
+ pTmpRoot->EndAllAction();
- m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( false );
- m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetFieldsDirty( false );
- }
+ pShell->LockView( bOldLockView );
+
+ m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( false );
+ m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetFieldsDirty( false );
+ break;
}
+
+ case IdleJob::Busy:
+ break;
+ case IdleJob::None:
+ break;
+ }
+
+ if ( IdleJob::None != eJob )
+ pIdle->Start();
+
#ifdef TIMELOG
if( pModLogFile && 1 != (long)pModLogFile )
delete pModLogFile, static_cast<long&>(pModLogFile) = 1;
diff --git a/sw/source/core/doc/SwDocIdle.cxx b/sw/source/core/doc/SwDocIdle.cxx
index 9461807943d8..5987274a6b3d 100644
--- a/sw/source/core/doc/SwDocIdle.cxx
+++ b/sw/source/core/doc/SwDocIdle.cxx
@@ -24,6 +24,7 @@
#include <vcl/scheduler.hxx>
#include "SwDocIdle.hxx"
+#include "IDocumentTimerAccess.hxx"
namespace sw
{
@@ -31,12 +32,17 @@ namespace sw
sal_uInt64 SwDocIdle::UpdateMinPeriod( sal_uInt64 /* nMinPeriod */, sal_uInt64 /* nTimeNow */ ) const
{
bool bReadyForSchedule = true;
+
SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
if( pView )
{
SwWrtShell& rWrtShell = pView->GetWrtShell();
bReadyForSchedule = rWrtShell.GetViewOptions()->IsIdle();
}
+
+ if( bReadyForSchedule && !m_rDoc.getIDocumentTimerAccess().IsDocIdle() )
+ bReadyForSchedule = false;
+
return bReadyForSchedule
? Scheduler::ImmediateTimeoutMs : Scheduler::InfiniteTimeoutMs;
}
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 883fcbac9047..9e2a82d3083c 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -141,11 +141,12 @@ using namespace ::com::sun::star::document;
return m_xGCIterator;
}
-void StartGrammarChecking( SwDoc &rDoc )
+bool SwDoc::StartGrammarChecking( bool bSkipStart )
{
// check for a visible view
bool bVisible = false;
- const SwDocShell *pDocShell = rDoc.GetDocShell();
+ bool bStarted = false;
+ const SwDocShell *pDocShell = GetDocShell();
SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, false );
while (pFrame && !bVisible)
{
@@ -160,17 +161,23 @@ void StartGrammarChecking( SwDoc &rDoc )
//!! a uno reference to them)
if (bVisible)
{
- uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() );
+ uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
if ( xGCIterator.is() )
{
- uno::Reference< lang::XComponent > xDoc( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
+ uno::Reference< lang::XComponent > xDoc( GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY );
// start automatic background checking if not active already
if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) )
- xGCIterator->startProofreading( xDoc, xFPIP );
+ {
+ bStarted = true;
+ if ( !bSkipStart )
+ xGCIterator->startProofreading( xDoc, xFPIP );
+ }
}
}
+
+ return bStarted;
}
/*
diff --git a/sw/source/core/inc/DocumentTimerManager.hxx b/sw/source/core/inc/DocumentTimerManager.hxx
index 698762ab087e..d8c1a76b2a14 100644
--- a/sw/source/core/inc/DocumentTimerManager.hxx
+++ b/sw/source/core/inc/DocumentTimerManager.hxx
@@ -34,8 +34,17 @@ namespace sw
class DocumentTimerManager : public IDocumentTimerAccess
{
public:
+ enum class IdleJob
+ {
+ None, ///< document has no idle jobs to do
+ Busy, ///< document is busy and idle jobs are postponed
+ Grammar,
+ Layout,
+ Fields,
+ };
DocumentTimerManager( SwDoc& i_rSwdoc );
+ virtual ~DocumentTimerManager() override;
void StartIdling() override;
@@ -47,15 +56,16 @@ public:
void StartBackgroundJobs() override;
- DECL_LINK( DoIdleJobs, Timer *, void );
-
- virtual ~DocumentTimerManager() override;
+ bool IsDocIdle() const override;
private:
-
DocumentTimerManager(DocumentTimerManager const&) = delete;
DocumentTimerManager& operator=(DocumentTimerManager const&) = delete;
+ DECL_LINK( DoIdleJobs, Timer *, void );
+
+ IdleJob GetNextIdleJob() const;
+
SwDoc& m_rDoc;
bool mbStartIdleTimer; //< idle timer mode start/stop
@@ -63,6 +73,11 @@ private:
SwDocIdle maDocIdle;
};
+inline bool DocumentTimerManager::IsDocIdle() const
+{
+ return( GetNextIdleJob() != IdleJob::Busy );
+}
+
}
#endif
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index 8f859fafd6c2..491017981728 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -524,7 +524,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
aCfg.GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bIsAutoGrammar;
if (pDoc && bIsAutoGrammar)
- StartGrammarChecking( *pDoc );
+ pDoc->StartGrammarChecking();
}
}
break;
commit 411f5e9cbd14bc3ffe7024b21434231662f6246d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Oct 6 11:35:06 2017 +0100
ofz#3566: fix oom
Change-Id: Id5bf172d49c61ad8000a5917759a54eaa0c8467e
Reviewed-on: https://gerrit.libreoffice.org/43195
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 0e27706c8fde..83dbc0b72424 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1374,7 +1374,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
nBytesPerRow = nRowSize;
}
- if ( bStatus )
+ if (bStatus)
{
//sanity check consider ReadMap condition for last row and
//last plane
@@ -1441,7 +1441,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
bStatus = false;
}
}
- else if ( nCompression == 5 )
+ else if (nCompression == 5)
{
sal_uInt32 np = nPlanes - 1;
if (np >= SAL_N_ELEMENTS(aMap))
@@ -1464,6 +1464,13 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
bStatus = false;
}
}
+ else if (nCompression == 32773)
+ {
+ }
+ else
+ {
+ bStatus = false;
+ }
}
if ( bStatus )
commit 02ab7371e10172bdf3474551f3912a148cdf66e2
Author: jan Iversen <jani at libreoffice.org>
Date: Fri Oct 6 14:50:22 2017 +0200
iOS cross-compile even for x86-64
Based on advice from IRC, cross compile is also active
for simulator.
The assumption build arch == host arch calls for not
cross compiling, did not work due to the fact that iOS
compiles without DESKTOP.
Cross compiling to the same platform gives problems with e.g. libxml2
will be solved in a later commit
Change-Id: If18ee5f9473dd983e2cb705390017229c4205a71
diff --git a/configure.ac b/configure.ac
index 396d02b88296..f02204df4b81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3075,7 +3075,7 @@ if test "$_os" = "WINNT"; then
BITNESS_OVERRIDE=64
fi
fi
-if test "$_os" = "iOS" -a "$host_cpu" = "arm64"; then
+if test "$_os" = "iOS"; then
cross_compiling="yes"
fi
commit ee75810ecb8f656c87363b8b952033c8ddb61de7
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Oct 6 12:45:45 2017 +0200
gbuild: more verbose forwarding of LinkTarget functions
The forwarding of LinkTarget subclass functions to LinkTarget functions
is currently done in a very elegant way that only requires listing the
bare function names once, but the downside is that the subclass
functions aren't defined in a way that "git grep" or "ctags" can find,
so replace that with more verbose copy-paste definitions.
Change-Id: I4bd7f1b1bc0904ae345958e39403ab508db584a1
Reviewed-on: https://gerrit.libreoffice.org/43196
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/solenv/gbuild/CompilerTest.mk b/solenv/gbuild/CompilerTest.mk
index e7f798ba0eae..f4dae61bd2f2 100644
--- a/solenv/gbuild/CompilerTest.mk
+++ b/solenv/gbuild/CompilerTest.mk
@@ -25,27 +25,27 @@ $(call gb_Helper_make_userfriendly_targets,$(1),CompilerTest)
endef
+# forward the call to the gb_LinkTarget implementation
+# (note: because the function name is in $(1), the other args are shifted by 1)
define gb_CompilerTest__forward_to_Linktarget
-gb_CompilerTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_CompilerTest_get_linktarget,$$(1)),$$(2),$$(3),CompilerTest_$$(1))
+$(call gb_LinkTarget_$(1),$(call gb_CompilerTest_get_linktarget,$(2)),$(3),$(4),CompilerTest_$(2))
endef
-$(eval $(foreach method, \
- add_cobject \
- add_cobjects \
- add_cxxobject \
- add_cxxobjects \
- add_exception_objects \
- add_objcobject \
- add_objcobjects \
- add_objcxxobject \
- add_objcxxobjects \
- add_cxxclrobject \
- add_cxxclrobjects \
- use_externals \
- use_udk_api \
-, \
- $(call gb_CompilerTest__forward_to_Linktarget,$(method)) \
-))
+# copy pasta for forwarding: this could be (and was) done more elegantly, but
+# these here can be found by both git grep and ctags
+gb_CompilerTest_add_cobject = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_cobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_cxxobject = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_cxxobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_exception_objects = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_objcobject = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_objcobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_objcxxobject = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_objcxxobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_cxxclrobject = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_add_cxxclrobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_use_externals = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
+gb_CompilerTest_use_udk_api = $(call gb_CompilerTest__forward_to_Linktarget,$(subst gb_CompilerTest_,,$(0)),$(1),$(2),$(3))
# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 0bd2e95b4efb..d0410466f846 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -412,61 +412,61 @@ $(foreach uiconfig,$(2),$(call gb_CppunitTest_use_uiconfig,$(1),$(uiconfig)))
endef
+# forward the call to the gb_LinkTarget implementation
+# (note: because the function name is in $(1), the other args are shifted by 1)
define gb_CppunitTest__forward_to_Linktarget
-gb_CppunitTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_CppunitTest_get_linktarget,$$(1)),$$(2),$$(3),CppunitTest_$$(1))
-
-endef
-
-$(eval $(foreach method,\
- add_cobject \
- add_cobjects \
- add_cxxobject \
- add_cxxobjects \
- add_exception_objects \
- use_executable_objects \
- use_library_objects \
- use_libraries \
- use_static_libraries \
- add_objcobject \
- add_objcobjects \
- add_objcxxobject \
- add_objcxxobjects \
- add_cxxclrobject \
- add_cxxclrobjects \
- add_asmobject \
- add_asmobjects \
- use_package \
- use_packages \
- set_precompiled_header \
- add_sdi_headers \
- add_cflags \
- set_cflags \
- add_cxxflags \
- set_yaccflags \
- add_objcflags \
- add_objcxxflags \
- add_cxxclrflags \
- add_defs \
- set_include \
- add_ldflags \
- set_ldflags \
- add_libs \
- disable_standard_system_libs \
- use_system_darwin_frameworks \
- use_system_win32_libs \
- use_internal_api \
- use_internal_bootstrap_api \
- use_internal_comprehensive_api \
- set_library_path_flags \
- use_external \
- use_externals \
- use_custom_headers \
- set_visibility_default \
- set_warnings_not_errors \
- set_external_code \
- set_generated_cxx_suffix \
-,\
- $(call gb_CppunitTest__forward_to_Linktarget,$(method))\
-))
+$(call gb_LinkTarget_$(1),$(call gb_CppunitTest_get_linktarget,$(2)),$(3),$(4),CppunitTest_$(2))
+
+endef
+
+# copy pasta for forwarding: this could be (and was) done more elegantly, but
+# these here can be found by both git grep and ctags
+gb_CppunitTest_add_cobject = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cobjects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cxxobject = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cxxobjects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_exception_objects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_executable_objects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_library_objects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_libraries = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_static_libraries = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_objcobject = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_objcobjects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_objcxxobject = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_objcxxobjects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cxxclrobject = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cxxclrobjects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_asmobject = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_asmobjects = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_package = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_packages = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_precompiled_header = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_sdi_headers = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_cflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cxxflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_yaccflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_objcflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_objcxxflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_cxxclrflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_defs = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_include = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_ldflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_ldflags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_add_libs = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_disable_standard_system_libs = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_system_darwin_frameworks = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_system_win32_libs = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_internal_api = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_internal_bootstrap_api = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_internal_comprehensive_api = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_library_path_flags = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_external = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_externals = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_use_custom_headers = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_visibility_default = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_warnings_not_errors = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_external_code = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
+gb_CppunitTest_set_generated_cxx_suffix = $(call gb_CppunitTest__forward_to_Linktarget,$(subst gb_CppunitTest_,,$(0)),$(1),$(2),$(3))
# vim: set noet sw=4:
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index 4d0041eb7cf0..8e955cc0ac79 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -85,67 +85,67 @@ define gb_Executable_set_targettype_gui
$(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktarget,$(1))) : TARGETGUI := $(2)
endef
-define gb_Executable_forward_to_Linktarget
-gb_Executable_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Executable_get_linktarget,$$(1)),$$(2),$$(3),Executable_$$(1))
+# forward the call to the gb_LinkTarget implementation
+# (note: because the function name is in $(1), the other args are shifted by 1)
+define gb_Executable__forward_to_Linktarget
+$(call gb_LinkTarget_$(1),$(call gb_Executable_get_linktarget,$(2)),$(3),$(4),Executable_$(2))
endef
-$(eval $(foreach method,\
- add_cobject \
- add_cobjects \
- add_cxxobject \
- add_cxxobjects \
- add_objcobject \
- add_objcobjects \
- add_objcxxobject \
- add_objcxxobjects \
- add_cxxclrobject \
- add_cxxclrobjects \
- add_grammar \
- add_grammars \
- add_scanner \
- add_scanners \
- add_exception_objects \
- add_generated_cobjects \
- add_generated_exception_objects \
- add_cflags \
- add_cxxflags \
- add_objcflags \
- add_objcxxflags \
- add_cxxclrflags \
- add_defs \
- set_include \
- add_ldflags \
- set_ldflags \
- add_libs \
- disable_standard_system_libs \
- use_system_darwin_frameworks \
- use_system_win32_libs \
- set_library_path_flags \
- use_api \
- use_sdk_api \
- use_udk_api \
- use_internal_api \
- use_internal_bootstrap_api \
- use_internal_comprehensive_api \
- use_library_objects \
- use_libraries \
- use_static_libraries \
- use_external \
- use_externals \
- use_custom_headers \
- use_package \
- use_packages \
- use_unpacked \
- add_sdi_headers \
- set_precompiled_header \
- add_nativeres \
- set_warnings_not_errors \
- set_external_code \
- set_generated_cxx_suffix \
-,\
- $(call gb_Executable_forward_to_Linktarget,$(method))\
-))
+# copy pasta for forwarding: this could be (and was) done more elegantly, but
+# these here can be found by both git grep and ctags
+gb_Executable_add_cobject = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cobjects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cxxobject = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cxxobjects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_objcobject = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_objcobjects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_objcxxobject = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_objcxxobjects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cxxclrobject = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cxxclrobjects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_grammar = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_grammars = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_scanner = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_scanners = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_exception_objects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_generated_cobjects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_generated_exception_objects = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cflags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cxxflags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_objcflags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_objcxxflags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_cxxclrflags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_defs = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_set_include = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_ldflags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_set_ldflags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_add_libs = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_disable_standard_system_libs = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_system_darwin_frameworks = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_system_win32_libs = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_set_library_path_flags = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_api = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_sdk_api = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_udk_api = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_internal_api = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_internal_bootstrap_api = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
+gb_Executable_use_internal_comprehensive_api = $(call gb_Executable__forward_to_Linktarget,$(subst gb_Executable_,,$(0)),$(1),$(2),$(3))
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list