31 Commits
Author SHA1 Message Date
Stephan Bergmann a0bc388b38 Use the saner std::condition_variable semantics for JobQueue::m_cndWait
This avoids the need for the tricky osl::Condition::reset calls.  For example,
the first one (in the "disposed !" case) had been added with
2a3ed89284 "sb132: #i112448# proper clean up in
JobQueue::enter (patch by olistraub)" as

>                  if( 0 == m_lstCallstack.front() )
>                  {
>                      // disposed !
> +                    if( m_lstJob.empty() )
> +                    {
> +                        osl_resetCondition( m_cndWait );
> +                    }
>                      break;
>                  }
>

and then change to

>                  if( 0 == m_lstCallstack.front() )
>                  {
>                      // disposed !
> -                    if( m_lstJob.empty() )
> +                    if( m_lstJob.empty()
> +                        && (m_lstCallstack.empty()
> +                            || m_lstCallstack.front() != 0) )
>                      {
>                          osl_resetCondition( m_cndWait );
>                      }

with cba3ac1eab "Avoid deadlocks when disposing
recursive JobQueue::enter", which prevented the reset from ever hapening
(because m_lstCallstack.front() cannot both be zero and non-zero here at the
same time).  The std::condition_variable semantics nicely avoid any reasoning
whether or not a reset would be necessary here.

Change-Id: Ic9b57b836bb6679829f4aa3b68679256726acf60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96406
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-16 10:02:24 +02:00
Stephan Bergmann d8feb7738d Model the dispose tokens as void const * instead of sal_Int64
...which avoids the sal_IntPtr casts

Change-Id: I518fcefc66d297b56c9bd94f7826a44715acb5f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96392
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-15 22:24:29 +02:00
Stephan Bergmann 78dc7d982b Remove a potentially already enqueued response when a bridge is disposed
...while a remote call is in progress.  Otherwise, if the same thread later
makes another remote call (through another bridge), it would erroneously pair
the repsonse for the disposed call with the second call.

UITest_calc_demo started to fail that way occasionally, presumably after
77445e201c "Make Chart Creation Wizard async", but
for reasons rather unrelated to the contents of that commit.  What apparently
happened is that in one test's tearDown, the bridge between the Python and the
soffice process happened to be disposed during the XDesktop::terminate call from
Python's main thread, so that the response (of type BOOLEAN) remained in the
JobQueue.  Then during the next test's setUp, XUnoUrlResolver::resolve from
Python's main thread would internally make a remote queryInterface call for the
initial StarOffice.ComponentContext object, which returns an ANY of either VOID
or XInterface type.  But that call was then mis-matched with the leftover
BOOLEAN response, causing failure.

I was able to reproduce that reliably on Linux with a local hack of

> diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx
> index 6c9324521f40..a87770bf8935 100644
> --- a/cppu/source/threadpool/jobqueue.cxx
> +++ b/cppu/source/threadpool/jobqueue.cxx
> @@ -71,6 +71,7 @@ namespace cppu_threadpool {
>              }
>
>              m_cndWait.wait();
> +            timespec ms{0, 1000000}; nanosleep(&ms, nullptr);
>
>              struct Job job={nullptr,nullptr};
>              {

introducing a sleep, so that other threads have a higher chance to dispose the
bridge (when the call being processed here is that XDesktop::dispose) after the
successful wait() but before the response is processed.  UITest_calc_demo then
failed with

[...]
> Execution time for create_chart.CalcChartUIDemo.test_activate_chart: 6.520
> tearDown: calling terminate()...
> caught while TearDown:
>  Traceback (most recent call last):
>   File "uitest/libreoffice/connection.py", line 127, in tearDown
>     xDesktop.terminate()
> libreoffice.connection.com.sun.star.lang.DisposedException: Binary URP bridge disposed during call binaryurp/source/bridge.cxx:611
>
> ok
> test_cancel_immediately (create_chart.CalcChartUIDemo) ...
[...]
> warn:sal.osl.pipe:423851:425076:sal/osl/unx/pipe.cxx:442: recv() failed: ECONNRESET
> warn:binaryurp:423851:425076:binaryurp/source/bridge.cxx:843: undisposed bridge "" in state 2, potential deadlock ahead
[...]
> ======================================================================
> ERROR: test_cancel_immediately (create_chart.CalcChartUIDemo)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "uitest/uitest/framework.py", line 25, in setUp
>     self.connection.setUp()
>   File "uitest/libreoffice/connection.py", line 176, in setUp
>     conn.setUp()
>   File "uitest/libreoffice/connection.py", line 57, in setUp
>     self.xContext = self.connect(socket)
>   File "uitest/libreoffice/connection.py", line 107, in connect
>     xContext = xUnoResolver.resolve(url)
> uno.com.sun.star.uno.RuntimeException: initial object queryInterface for OID "StarOffice.ComponentContext" returned ANY of type boolean binaryurp/source/bridge.cxx:883
[...]

Change-Id: Icf9aadbb38e7aafffff844fe8e9ae99e165c1f33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96326
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-15 16:07:26 +02:00
Arkadiy Illarionov 5af9e26ae8 Simplify containers iterations in cppcanvas, cppu, cppuhelper
Use range-based loop or replace with STL functions

Change-Id: I72bf7cdb632c04e2fc8d4f7ab85cb6571222aa07
Reviewed-on: https://gerrit.libreoffice.org/68636
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-03 16:27:08 +01:00
Chris Sherlock 97eb00c75e revert OSL_ASSERT changes
Change-Id: I365d140446bd2a62cf8256acbfdd53fe72987380
2017-05-07 17:03:35 +10:00
Chris Sherlock 1f4c85d0f5 tdf#43157: convert cppu's threadpool from OSL_ASSERT to assert
Change-Id: Id9cb46db0dd6f635014982ce958804dd0f02dd83
2017-05-07 07:55:40 +10:00
Noel Grandin f651ea26ea std::list<sal_Int64> -> std::deque
Change-Id: Ib34d6bf97fc97ea1c30c184a7de4ace7f533065f
2016-09-01 11:05:21 +02:00
Noel Grandin aad80e0b9a cppcheck:useInitializationList
Change-Id: I744ff3e268fbffca9499121f3567640934aaae51
Reviewed-on: https://gerrit.libreoffice.org/20110
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-22 12:14:53 +00:00
Stephan Bergmann 4730b58d99 loplugin:nullptr (automatic rewrite)
Change-Id: I17eb40b2923793280ea220e519f97563c8490a19
2015-11-10 10:31:20 +01:00
Stephan Bergmann 2861d5bedc Some oslCondition -> osl::Condition
Change-Id: I86cfbefd1cb8b22fca659a158b8e31d5c991de7a
2015-08-18 08:16:18 +02:00
Stephan Bergmann 34a44156b3 cppu: sal_Bool -> bool
Change-Id: I1288f1f6f38d1475b4eb5272509e479bd9f2552d
2014-02-17 17:55:18 +01:00
Takeshi Abe ce33f85ffd sal_Bool to bool
Change-Id: I8c554fb3faead41c974af9c2a89728bd0bdf5eb6
2013-03-04 23:14:41 +09:00
Michael Meeks c3a6a57fc2 re-base on ALv2 code. 2012-06-13 14:18:29 +01:00
Michael Stahl a860cd108c cppu: JobQueue::enter: add mutex guards for m_nToDo
Considered replacing it with oslInterlockedCount, but wondered why there is
no osl_getInterlockedCount (similar to glib's g_atomic_int_get)...
2012-02-27 20:53:20 +01:00
Stephan Bergmann cba3ac1eab Avoid deadlocks when disposing recursive JobQueue::enter
...where the outer JobQueue::enter blocks on m_cndWait after it has been reset
again due to m_lstJob.empty().
2012-02-10 16:26:00 +01:00
Norbert Thiebaud 24b4c075d5 remove include of pch header in cppu 2011-11-27 13:02:56 -06:00
Norbert Thiebaud d7fc91fcd1 Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
* commit 'ooo/DEV300_m101': (185 commits)
  chart52: cleanup unused legend entry stuff in preparation of issue #i82802#
  masterfix: #i10000# add missing dependency in offapi
  sb138: #i115619# fix for MinGW
  sb138: #i115619#, #i116038# use osl_setThreadName in binaryurp
  sb138: #i115619# osl_setThreadName
  gridsort: i116682: update UnoControlDialog to reflect XDialog
  gridsort: minor changes to the new API: - renamed XMutableGridDataModel::setRowHeading to updateRowHeading for consistency reasons - renamed XSortableGridDataModel to XSortableGridData - actually, this is not a full-fledged model in itself.
  gridsort: grid control related unit tests (first set, more to come)
  sb138: #i116038# fresh implementation of binary URP bridge
  chart52: #28670# make the legend within charts resizeable - part 2
  gridsort: re-did the column resizing - introduced XGridColumn.Flexibility, determining to which degree the column is resized during auto-column-resizing - removed XGridColumn.PreferredWidth - there really is no need for this anymore now - documented the relationship between XGridColumn.Flexibility and XGridColumn.Resizeable - re-implemented TableControl_Impl::impl_ni_updateColumnWidths, with (hopefully) less magic
  sb139: #i116530# improve Java URP bridge error notification by utilizing the java.lang.Throwable cause facility
  gridsort: document the relationship between soorting the data and notifying XGridDataListeners
  gridsort: introduce XGridColumn::DataModelIndex. this allows for column removal/insertion at the GridColumnModel, without the need to touch the GridDataModel
  locales34: #i112431# adapt documentation to reality
  gridsort: introduce XSortableGridDataModel::removeColumnSort
  gridsort: #163172# added UNO API support for sorting grid data. Implementation still unfinished. Things missing in the SortableGridData implementation - add as listener to the delegator, so we're notified of changes - translate and multiplex those changes - do own notifications (XGridDataListener.dataChanged) when the sort order changed - (possibly) update the sort order when the data in the current sort-column changed
  gridsort: made the row title a row heading, being an Any instead of a string
  gridsort: XMutableGridData: renamed updateRow to updateRowData for consistency; introduced updateRowToolTip as shortcut for multiple updateCellToolTip calls
  gridsort: updateCell->updateCellData, setCellToolTip->updateCellToolTip; in both methods, have (Col,Row) params instead of (Row,Col), for consistency reasons
  ...

Conflicts:
	bridges/inc/bridges/remote/bridgeimpl.hxx
	bridges/inc/bridges/remote/connection.h
	bridges/inc/bridges/remote/context.h
	bridges/inc/bridges/remote/helper.hxx
	bridges/inc/bridges/remote/mapping.hxx
	bridges/inc/bridges/remote/proxy.hxx
	bridges/inc/bridges/remote/remote.h
	bridges/inc/bridges/remote/remote.hxx
	bridges/inc/bridges/remote/stub.hxx
	bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
	bridges/source/remote/context/context.cxx
	bridges/source/remote/static/helper.cxx
	bridges/source/remote/static/mapping.cxx
	bridges/source/remote/static/proxy.cxx
	bridges/source/remote/static/remote.cxx
	bridges/source/remote/static/remote_types.cxx
	bridges/source/remote/static/remote_types.hxx
	bridges/source/remote/static/stub.cxx
	bridges/source/remote/urp/urp_bridgeimpl.cxx
	bridges/source/remote/urp/urp_bridgeimpl.hxx
	bridges/source/remote/urp/urp_cache.h
	bridges/source/remote/urp/urp_cache.hxx
	bridges/source/remote/urp/urp_dispatch.cxx
	bridges/source/remote/urp/urp_dispatch.hxx
	bridges/source/remote/urp/urp_environment.cxx
	bridges/source/remote/urp/urp_job.cxx
	bridges/source/remote/urp/urp_job.hxx
	bridges/source/remote/urp/urp_log.cxx
	bridges/source/remote/urp/urp_log.hxx
	bridges/source/remote/urp/urp_marshal.cxx
	bridges/source/remote/urp/urp_marshal.hxx
	bridges/source/remote/urp/urp_marshal_decl.hxx
	bridges/source/remote/urp/urp_property.hxx
	bridges/source/remote/urp/urp_propertyobject.cxx
	bridges/source/remote/urp/urp_propertyobject.hxx
	bridges/source/remote/urp/urp_reader.cxx
	bridges/source/remote/urp/urp_reader.hxx
	bridges/source/remote/urp/urp_replycontainer.hxx
	bridges/source/remote/urp/urp_threadid.cxx
	bridges/source/remote/urp/urp_threadid.hxx
	bridges/source/remote/urp/urp_unmarshal.cxx
	bridges/source/remote/urp/urp_unmarshal.hxx
	bridges/source/remote/urp/urp_writer.cxx
	bridges/source/remote/urp/urp_writer.hxx
	cppu/source/threadpool/threadpool.cxx
	cppu/util/target.pmk
	cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
	cppuhelper/source/interfacecontainer.cxx
	cpputools/source/regcomplazy/regcomplazy.cxx
	jurt/prj/d.lst
	jvmfwk/source/elements.cxx
	offapi/com/sun/star/awt/grid/GridDataEvent.idl
	offapi/com/sun/star/awt/grid/XGridColumn.idl
	offapi/com/sun/star/awt/tab/makefile.mk
	offapi/com/sun/star/chart2/ExplicitIncrementData.idl
	offapi/com/sun/star/chart2/XPlotter.idl
	offapi/com/sun/star/chart2/XUndoHelper.idl
	offapi/com/sun/star/document/MediaDescriptor.idl
	offapi/com/sun/star/document/makefile.mk
	offapi/com/sun/star/linguistic2/XLanguageGuessing.idl
	offapi/com/sun/star/script/ModuleInfo.idl
	offapi/com/sun/star/script/ModuleType.idl
	offapi/com/sun/star/text/TextMarkupType.idl
	offapi/com/sun/star/util/XTextSearch.idl
	offapi/com/sun/star/xml/sax/XFastAttributeList.idl
	pyuno/source/loader/makefile.mk
	remotebridges/source/bridge/bridge_connection.cxx
	remotebridges/source/bridge/bridge_connection.hxx
	remotebridges/source/bridge/bridge_provider.cxx
	remotebridges/source/bridge/remote_bridge.cxx
	remotebridges/source/bridge/remote_bridge.hxx
	remotebridges/source/dynamicloader/dynamicloader.cxx
	remotebridges/source/factory/bridgefactory.cxx
	remotebridges/source/factory/bridgeimpl.cxx
	remotebridges/source/factory/bridgeimpl.hxx
	remotebridges/source/factory/makefile.mk
	sal/cppunittester/cppunittester.cxx
	sal/inc/osl/diagnose.h
	sal/osl/os2/system.h
	sal/osl/unx/diagnose.c
	sal/osl/unx/file_misc.cxx
	sal/osl/unx/process_impl.cxx
	sal/osl/w32/diagnose.c
	sal/osl/w32/process.cxx
	sal/prj/build.lst
	sal/qa/rtl/math/makefile.mk
	sal/qa/rtl/math/rtl_math.cxx
	sal/qa/rtl/math/rtl_old_testint64.cxx
	sal/qa/rtl/math/test_rtl_math.cxx
	sal/systools/win32/kill/kill.cxx
	sal/textenc/tencinfo.c
	sal/util/sal.map
	stoc/source/inspect/introspection.cxx
	stoc/source/security/file_policy.cxx
	stoc/source/simpleregistry/simpleregistry.cxx
2011-03-08 22:29:39 -06:00
Julien Nabet 6ca25e8192 Some cppcheck cleaning 2011-01-12 13:12:22 +00:00
sb 2a3ed89284 sb132: #i112448# proper clean up in JobQueue::enter (patch by olistraub) 2010-10-25 15:37:14 +02:00
Sebastian Spaeth a715e1b3d0 Add vim/emacs modelines to all source files
Fixes #fdo30794
Based on bin/add-modelines script (originally posted in mail
1286706307.1871.1399280959@webmail.messagingengine.com)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-10-14 17:04:31 +02:00
Caolán McNamara 521a9f6f76 #i107490# cppu lifecycle cleanup 2010-10-11 12:37:08 +01:00
sb 648603aa7c sb126: #i107490# cppu lifecycle cleanup (patch by cmc, plus removal of now obsolete CPPU_LEAK_STATIC_DATA) 2010-07-07 13:03:20 +02:00
Jens-Heiner Rechtien 7c80db2eb3 changefileheader2: #i109125#: change source file copyright notice from Sun Microsystems to Oracle; remove CVS style keywords (RCSfile, Revision) 2010-02-12 15:01:35 +01:00
Rüdiger Timm 9d23834e45 INTEGRATION: CWS changefileheader (1.7.74); FILE MERGED
2008/03/31 07:23:20 rt 1.7.74.1: #i87441# Change license header to LPGL v3.
2008-04-11 09:33:02 +00:00
Oliver Bolte 2a40cb9bd0 INTEGRATION: CWS pchfix02 (1.6.10); FILE MERGED
2006/09/01 17:23:01 kaib 1.6.10.1: #i68856# Added header markers and pch files
2006-09-16 23:19:29 +00:00
Jens-Heiner Rechtien b4d3092287 INTEGRATION: CWS warnings01 (1.2.46); FILE MERGED
2005/09/22 20:42:24 sb 1.2.46.2: RESYNC: (1.2-1.3); FILE MERGED
2005/08/31 13:43:19 sb 1.2.46.1: #i53898# Made code warning-free.
2006-06-19 12:12:04 +00:00
Kurt Zenker 54ec29f389 INTEGRATION: CWS jsc9 (1.4.2); FILE MERGED
2006/04/26 14:15:32 jsc 1.4.2.1: #134738# move fixes back to previous version
2006-04-26 19:49:54 +00:00
Jens-Heiner Rechtien 9d70ef32f3 INTEGRATION: CWS sb49 (1.3.38); FILE MERGED
2006/03/22 10:14:04 sb 1.3.38.1: #i63397# Keep objects alive long enough so that threads still running while atexit handlers are processed do not access dead objects.
2006-04-19 12:48:47 +00:00
Rüdiger Timm 658bd7e75b INTEGRATION: CWS ooo19126 (1.2.50); FILE MERGED
2005/09/05 13:54:24 rt 1.2.50.1: #i54170# Change license header: remove SISSL
2005-09-08 07:45:56 +00:00
Sander Vesik db83509ccf INTEGRATION: CWS ooo20040329 (1.1.1.1.140); FILE MERGED
2004/03/17 11:38:59 waratah 1.1.1.1.140.1: #i1858# alter the order of some definitions to fix some -Wall warnings
2004-04-21 11:56:50 +00:00
Jens-Heiner Rechtien b525a3115f initial import 2000-09-18 14:29:57 +00:00