Commit graph

449 commits

Author SHA1 Message Date
Herbert Dürr
1ad6f436b5 protect UNO EnvStack's s_setCurrent() against unknown threadid
untracked threadIds have been observed and can result in crashes.
s_getCurrent() already checks them and s_setCurrent() does it now.

(cherry picked from commit bf8e3135ac906ce0ab7d6d9ccbd434f1597f2ff4)

Conflicts:
	cppu/source/uno/EnvStack.cxx

Change-Id: If35237179c1ee3b854e6183294ed72a6d0b105a8
2013-05-09 09:30:45 +01:00
Luboš Luňák
e2e2cc6114 remove usage of RTL_CONSTASCII_USTRINGPARAM
Mechanical removal of usage together with OUString ctor, done
by compiler plugin.

Change-Id: I554227f76df0dac620b1b46fca32516f78b462c5
2013-05-06 16:51:45 +02:00
Tor Lillqvist
8a9398fad0 WaE: variable 'hMod' set but not used
Change-Id: Iae64943671a576159be0fa311bc503aa96b2b5df
2013-04-16 20:24:07 +03:00
Matúš Kukan
65be07720b do not use deprecated rtl_registerModuleForUnloading
Change-Id: I59014906c8409fc7ac0f155c9562613c309b8b06
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2013-04-16 17:52:36 +02:00
Thomas Arnhold
435f5e30c9 fdo#60724 correct spelling
Change-Id: I7318a9f4f3410edf4dbe67bf08f31682fcb4edc7
2013-04-15 05:10:29 +02:00
Thomas Arnhold
39d45390f4 removal of RTL_CONSTASCII_USTRINGPARAM for quoted OUStrings declarations
s/(OUString\s+[a-zA-Z_][A-Za-z0-9_]*\s*)\(\s*RTL_CONSTASCII_USTRINGPARAM\s*\((\s*"[^")]*?"\s*)\)\s*\)/$1\($2\)/gms

Change-Id: Iad20f242c80c4bdc69df17e2d7a69d58ea53654b
Reviewed-on: https://gerrit.libreoffice.org/2835
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2013-03-19 10:48:30 +00:00
Thomas Arnhold
8b27d78b4a automated removal of RTL_CONSTASCII_USTRINGPARAM for quoted OUStrings
Done with a perl regex:

s/OUString\s*\(\s*RTL_CONSTASCII_USTRINGPARAM\s*\((\s*"[^")]*?"\s*)\)\s*\)/OUString\($1\)/gms

Change-Id: Idf28320817cdcbea6d0f7ec06a9bf51bd2c3b3ec
Reviewed-on: https://gerrit.libreoffice.org/2832
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2013-03-19 09:00:26 +00:00
Julien Nabet
4343c49717 coverity#705137 Missing break in switch
Change-Id: Ie54c888e15e9564c7e1d0efb54f587a586a53631
Reviewed-on: https://gerrit.libreoffice.org/2780
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
2013-03-18 10:05:33 +00:00
Stephan Bergmann
f4b218d164 *ppRet cannot become non-null there out of thin air
Change-Id: Idd08a89dd0dcf05caeacc9e14a0a6ea10b433588
2013-03-05 21:26:30 +01:00
Takeshi Abe
ce33f85ffd sal_Bool to bool
Change-Id: I8c554fb3faead41c974af9c2a89728bd0bdf5eb6
2013-03-04 23:14:41 +09:00
Thomas Arnhold
26e37ca4c7 doubled includes
Change-Id: I70ec796188e2388e1e4d699126f7ae817f5ff86e
2013-03-04 13:58:40 +01:00
Thomas Arnhold
f5ca04caca Related to fdo#60724: correct spelling
Using the autocorrect list of LibreOffice
extras/source/autotext/lang/en-US/acor/DocumentList.xml

Change-Id: I8b93969bc0742c2e95b8b7db3c4c37691e8d3657
Script: http://pastebin.ca/2327716
2013-03-03 17:14:16 +01:00
Stephan Bergmann
925e14220e osl_atomic_increment/decrement are macros
Change-Id: Ib2d61e436d625ac89defe718d4cc1d866d538397
2013-02-21 16:50:01 +01:00
Stephan Bergmann
f1bca26afc Remove redundant braces around for loops
...that had once been workarounds for compilers that did not yet support the
C++98 scoping rules for declarations in for-init-statements.

Change-Id: I51dc42982b30bf3adea6de1a10a91c0b4b4acfbe
2013-01-26 16:36:09 +01:00
Stephan Bergmann
d55155cad0 Include <cassert>
Also, move assert into uno_type_sequence_construct so that all its callers
benefit.

Also, change some OSL_ENSURE to assert.

Change-Id: Idd0a03c4aa6eed1db453db84602c01ff16f0d72c
2013-01-15 11:25:59 +01:00
Julien Nabet
8c3c491d4f Some cppcheck cleaning
Change-Id: Iac1c26d031e8196ef93cb403dc60f07e0eef6380
2012-12-27 22:58:07 +01:00
Thorsten Behrens
66a175834c c++ API: use css alias in generated headers, adds global css decl
This changes all generated API headers (.hpp and .hdl) to use a
namespace alias 'css' instead of the pointlessly long com::sun::star

Makes the change in cppumaker & associated tools, adds a global
namespace alias definition in sal/types.h, and removes a kiloton
of local, now pointless-to-harmful versions of that alias from all
over the code.

Change-Id: Ice5a644a6b971a981f01dc0589d48f5add31cc0f
2012-11-30 14:36:36 +01:00
Stephan Bergmann
12fa9ece66 Avoid global static data
...that (indirectly) allocates memory via rtl/alloc.h, thereby causing the
rtl_cache_wsupdate_init thread to be spawned before main, as on Mac OS X that
would interfere with the code in sal_detail_initialize to close all file
descriptors >= 3 -- on Mac OS X the pthreads implementation makes use of KQUEUE
file descriptors.

* This commit removes enough global static data to make ui-preview work again on
Mac OS X (where it crashed at startup when the main thread closed the KQUEUE fd
used by pthreads implementation threads).  gengal uses further static data (at
least from module sb), so needs further clean-up.

* Avoiding global static instances derived from class Application required the
introduction of vcl/vclmain.hxx.

* That the vcl library was linked against the static vclmain library (which only
provides an implementation of main) appears to me to be a historic relic (all
executables should either include a SAL_IMPLEMENT_MAIN or link against vclmain),
so I removed that.

Change-Id: I048aa616208cb3a1b9bd8dcc3b729ba1665729bd
2012-11-13 18:04:26 +01:00
Tor Lillqvist
97593ae24a Handle lack of module loading/unloading API when DISABLE_DYNLOADING
There are basicically two classes of cases:

1) Where the code is for obscure historical reasons or what I see as
misguided "optimization" split into a more libraries than necessary,
and these then are loaded at run-time. Instead, just use direct
linking.

2) Where dynamic loading is part of the functionality offered to some
upper (scripting etc) layer, or where some system-specific non-LO
library is loaded dynamically, as it is not necessarily present on
end-user machines. Can't have such in the DISABLE_DYNLOADING case.

Change-Id: I9eceac5fb635245def2f4f3320821447bb7cd8c0
2012-10-07 07:59:15 +03:00
Arnaud Versini
36a2db3722 Replace usage of rtl_*Memory with equivalent from string.h
Change-Id: I50ffc10f007f03c3252ef0196b59b881429cc159
Reviewed-on: https://gerrit.libreoffice.org/734
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
2012-10-01 18:48:05 +00:00
Tor Lillqvist
f09f52e4ad Need also uno_ext_getMapping for Java when DISABLE_DYNLOADING
Change-Id: I65f09e54c80df4e96e24548692eeb3a57e1de517
2012-09-21 14:46:24 +03:00
Tor Lillqvist
e5045bea0a Adapt for DISABLE_DYNLOADING possibility also for Android
Change-Id: Ie1ff96b6f58bf694b8d08a3316144becaaefe6d9
2012-09-21 14:46:12 +03:00
Tor Lillqvist
69765868e3 DISABLE_DYNLOADING magic also for the jni_uno environment
Change-Id: I5e966a5734308381ad305b891ecfc830dc1419f6
2012-09-20 12:52:15 +03:00
Norbert Thiebaud
195f17ee40 migrate some of the biggest consumer of osl_*InterlockedCount to osl_atomic
Change-Id: I0e6992afbeffaf3b993e6630fb396d93012890e0
Reviewed-on: https://gerrit.libreoffice.org/632
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
2012-09-17 14:26:12 +00:00
Arnaud Versini
3638561bef Replace usage of rtl/memory.h in cppu with their equivalent from string.h
Change-Id: Ia49c97ad58b21dc360a366260b62bcc6b4975dee
2012-07-29 21:30:34 +02:00
Arnaud Versini
b8d5620181 Use memset and memcmp insteadof rtl_zeroMemory and rtl_compareMemory in cppu
Change-Id: I88976b215bc23ce5001916ccf123bc3561c2a33a
2012-07-24 20:35:21 +02:00
Stephan Bergmann
a4967e4a75 Assertion clean-up
Change-Id: I234c615d9d3386da2b244709add5c029b76d346c
2012-07-23 15:18:02 +02:00
Tor Lillqvist
4b5f1d7b2d WaE: unused variable
Change-Id: Ie355701716c7106ef2afd76ae8b6544a00ac474c
2012-07-23 15:12:21 +03:00
Caolán McNamara
73f453bd11 just use rtl::OUString::createFromAscii
Change-Id: I425e7bcc8f81b2d67a98244ba4419ace1ba569ec
2012-07-03 21:21:09 +01:00
Caolán McNamara
7d851250e5 we don't need to check for complete length, any non 0 length will do
Change-Id: I6978524ef934ee97d151e0fd22f3a0dfc91fd26e
2012-07-03 21:21:09 +01:00
Caolán McNamara
57ea40b8b6 WaE: clear higher debugging levels warnings
Change-Id: I611dc412b5461f368f23aa8239e48d0e175f5168
2012-06-15 15:41:12 +01:00
Michael Meeks
c3a6a57fc2 re-base on ALv2 code. 2012-06-13 14:18:29 +01:00
Michael Meeks
544c785c13 quiet potential size warnings. 2012-06-13 14:09:19 +01:00
Michael Meeks
aa00f6f1ce targetted sb140 revert. 2012-06-13 14:09:19 +01:00
Stephan Bergmann
2fa2660b55 Better fix for ThreadPool/ORequestThread life cycle
This is a follow up to d015384e1d "Fixed
ThreadPool (and dependent ORequestThread) life cycle" that still had some
problems:

* First, if Bridge::terminate was first entered from the reader or writer
thread, it would not join on that thread, so that thread could still be running
during exit.

That has been addressed by giving Bridge::dispose new semantics:  It waits until
both Bridge::terminate has completed (even if that was called from a different
thread) and all spawned threads (reader, writer, ORequestThread workers) have
been joined.  (This implies that Bridge::dispose must not be called from such a
thread, to avoid deadlock.)

* Second, if Bridge::terminate was first entered from an ORequestThread, the
call to uno_threadpool_dispose(0) to join on all such worker threads could
deadlock.

That has been addressed by making the last call to uno_threadpool_destroy wait
to join on all worker threads, and by calling uno_threadpool_destroy only from
the final Bridge::terminate (from Bridge::dispose), to avoid deadlock.  (The
special semantics of uno_threadpool_dispose(0) are no longer needed and have
been removed, as they conflicted with the fix for the third problem below.)

* Third, once uno_threadpool_destroy had called uno_threadpool_dispose(0), the
ThreadAdmin singleton had been disposed, so no new remote bridges could
successfully be created afterwards.

That has been addressed by making ThreadAdmin a member of ThreadPool, and making
(only) those uno_ThreadPool handles with overlapping life spans share one
ThreadPool instance (which thus is no longer a singleton, either).
Additionally, ORequestThread has been made more robust (in the style of
salhelper::Thread) to avoid races.

Change-Id: I2cbd1b3f9aecc1bf4649e482d2c22b33b471788f
2012-05-23 10:10:51 +02:00
Stephan Bergmann
d015384e1d Fixed ThreadPool (and dependent ORequestThread) life cycle
At least with sw_complex test under load, it happened that an ORequestThread
could still process a remote release request while the main thread was already
in exit(3).  This was because (a) ThreadPool never joined with the spawned
worker threads (which has been rectified by calling uno_threadpool_dispose(0)
from the final uno_threadpool_destroy), and (b) binaryurp::Bridge called
uno_threadpool_destroy only from its destructor (which could go as late as
exit(3)) instead of from terminate.

Additional clean up:
* Access to Bridge's threadPool_ is now cleanly controlled by mutex_ (even
  though that might not be necessary in every case).
* ThreadPool's stopDisposing got renamed to destroy, to make meaning clearer.

Change-Id: I45fa76e80e790a11065e7bf8ac9d92af2e62f262
2012-05-16 22:09:21 +02:00
Caolán McNamara
df6d495f2a fix OSL_DEBUG_LEVEL > 1 build 2012-04-26 11:41:59 +01:00
Stephan Bergmann
61a8905c48 Reverted "Leak TypeDescriptor_Init_Impl to avoid problems at exit."
(This reverts commit 0ba6bd3ddc025666a6d4bb0640bf443728b23bd3.)

The problems worked-around there are no longer observed by me, so they
were hopefully only a temporal problem (the real root cause had never
been found back then).  If problems start to pop up again, we'll need
to have another look at this.
2012-04-26 09:33:12 +02:00
Catalin Iacob
fd0790a219 WaE: Clang unused variable 2012-04-25 10:07:00 +02:00
Szabolcs Dezsi
d6bc02f8c4 Replaced equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(...)) with == operator 2012-04-06 20:03:42 +02:00
Szabolcs Dezsi
743f22045c Replaced equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(...)) with == operator
Pattern used:

find . -name "*.cxx" -exec sed -i 's/\( *\)\(else if\|if\) *( *\([^!()|&]*\)\.equalsAsciiL( *RTL_CONSTASCII_STRINGPARAM *( *\([^)]*\)) *) *)$/\1\2 ( \3 == \4 )/' \{\} \;
2012-04-06 15:07:41 +02:00
Tor Lillqvist
694bb9f5de Do two fairly useless but often emitted OSL_TRACEs only if OSL_DEBUG_LEVEL > 2 2012-04-05 20:46:26 +03:00
Tor Lillqvist
128749140f More hacking on static linking (iOS) support 2012-03-21 00:00:05 +02:00
Tor Lillqvist
c0ab229dc7 Uniquify uno_initEnvironment and uno_ext_getMapping in the static linking case 2012-03-21 00:00:04 +02:00
Tor Lillqvist
a8f19ca300 Use MAX_ALIGNMENT_4 also for iOS 2012-03-21 00:00:02 +02:00
Stephan Bergmann
ba6714d34f Dead code 2012-03-14 15:23:22 +01:00
Stephan Bergmann
6e67c03dc0 Enable -Wnon-virtual-dtor for GCC 4.6
...which has the necessary features to support it.

Change a lot of classes to either contain a protected non-virtual dtor
(which is backwards compatible, so even works for cppumaker-generated
UNO headers) or a public virtual one.

cppuhelper/propertysetmixin.hxx still needs to disable the warning, as
the relevant class has a non-virtual dtor but friends, which would still
cause GCC to warn.

Includes a patch for libcmis, intended to be upstreamed.
2012-03-14 13:32:02 +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
Alexander Bergmann
0439af27e1 Code cleanup: ( () ) replaced by (()) 2012-01-26 17:41:07 +00:00