Commit graph

3389 commits

Author SHA1 Message Date
Stephan Bergmann
7f927322d9 configmgr: Better handling of finalized vs. non-finalized in the same layer
When there are multiple competing configuration settings for the same
configuration layer (e.g., in xcu files of two different extensions from the
same extension layer), then the setting that is read last always won, even if
any of the settings read earlier is marked as finalized.  (The reason for
originally doing it that way was that it kept the code logic somewhat simple.)

However, esp. for a scenario of multiple extensions in one extension layer
(bundled, shared, or user), it can be unexpected by a user that a non-finalized
setting (that comes from the extension that happens to be read last) can win
over a finalized one.

Therefore, change the logic accordingly.  Now, if any of the competing settings
are finalized, the first finalized one that is read wins.

Change-Id: I22aeade543a5b26d95d49cfcb561f974cd7a5081
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177737
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-12-03 16:26:52 +01:00
Caolán McNamara
4f7cdf40de drop a TODO
I don't think anyone is getting around to changing this after 13
years, and an int worth of config layers looks safe enough to me.

Change-Id: Iecf00a4d342e60d8f56a27978c40fa8d861ecd7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177428
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-11-27 17:16:36 +01:00
Caolán McNamara
a025eef003 cid#1606638 silence Overflowed integer argument
and

cid#1608572 Overflowed integer argument
cid#1607772 Overflowed integer argument
cid#1607196 Overflowed integer argument
cid#1606568 Overflowed return value
cid#1607573 Overflowed return value

Change-Id: I9a701b19026572127399712c3b660094f2a0bd40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176740
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-11-18 22:24:40 +01:00
Mike Kaganski
56f3dbffdf Simplify a bit
Change-Id: I618b0f8bcb2e8032ee12367c73e1136685f66b3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176183
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-08 05:34:20 +01:00
Noel Grandin
5fdfc074c9 loplugin:passstuffbyref make some small improvements
Change-Id: Ib14a2e6b41165887fcf99c3d155850faa8564822
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176218
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-07 17:20:09 +01:00
Caolán McNamara
23d7910c1e cid#1554844 COPY_INSTEAD_OF_MOVE
and

cid#1554878 COPY_INSTEAD_OF_MOVE
cid#1554907 COPY_INSTEAD_OF_MOVE
cid#1555082 COPY_INSTEAD_OF_MOVE
cid#1555224 COPY_INSTEAD_OF_MOVE
cid#1555301 COPY_INSTEAD_OF_MOVE
cid#1555378 COPY_INSTEAD_OF_MOVE
cid#1555395 COPY_INSTEAD_OF_MOVE
cid#1555452 COPY_INSTEAD_OF_MOVE
cid#1555466 COPY_INSTEAD_OF_MOVE
cid#1555514 COPY_INSTEAD_OF_MOVE
cid#1555566 COPY_INSTEAD_OF_MOVE
cid#1555753 COPY_INSTEAD_OF_MOVE
cid#1555782 COPY_INSTEAD_OF_MOVE
cid#1555825 COPY_INSTEAD_OF_MOVE
cid#1555842 COPY_INSTEAD_OF_MOVE
cid#1555891 COPY_INSTEAD_OF_MOVE
cid#1555917 COPY_INSTEAD_OF_MOVE
cid#1555961 COPY_INSTEAD_OF_MOVE
cid#1556021 COPY_INSTEAD_OF_MOVE
cid#1556055 COPY_INSTEAD_OF_MOVE
cid#1556307 COPY_INSTEAD_OF_MOVE
cid#1556349 COPY_INSTEAD_OF_MOVE
cid#1556436 COPY_INSTEAD_OF_MOVE
cid#1556665 COPY_INSTEAD_OF_MOVE
cid#1556696 COPY_INSTEAD_OF_MOVE
cid#1556718 COPY_INSTEAD_OF_MOVE
cid#1556775 COPY_INSTEAD_OF_MOVE
cid#1556835 COPY_INSTEAD_OF_MOVE
cid#1556877 COPY_INSTEAD_OF_MOVE
cid#1556994 COPY_INSTEAD_OF_MOVE
cid#1557010 COPY_INSTEAD_OF_MOVE
cid#1557074 COPY_INSTEAD_OF_MOVE
cid#1557111 COPY_INSTEAD_OF_MOVE
cid#1557142 COPY_INSTEAD_OF_MOVE
cid#1557163 COPY_INSTEAD_OF_MOVE
cid#1557164 COPY_INSTEAD_OF_MOVE
cid#1557214 COPY_INSTEAD_OF_MOVE
cid#1557254 COPY_INSTEAD_OF_MOVE
cid#1557322 COPY_INSTEAD_OF_MOVE
cid#1557327 COPY_INSTEAD_OF_MOVE
cid#1557492 COPY_INSTEAD_OF_MOVE
cid#1557565 COPY_INSTEAD_OF_MOVE
cid#1557663 COPY_INSTEAD_OF_MOVE
cid#1557798 COPY_INSTEAD_OF_MOVE

Change-Id: I2ae9c184dcc18d44a65437e18c49e16b27f4d81d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174893
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-10-14 15:28:24 +02:00
Caolán McNamara
0a5ce68dc3 cid#1632259 COPY_INSTEAD_OF_MOVE
and

cid#1632258 COPY_INSTEAD_OF_MOVE
cid#1632257 COPY_INSTEAD_OF_MOVE
cid#1632256 COPY_INSTEAD_OF_MOVE
cid#1632255 COPY_INSTEAD_OF_MOVE
cid#1632254 COPY_INSTEAD_OF_MOVE
cid#1632253 COPY_INSTEAD_OF_MOVE
cid#1632252 COPY_INSTEAD_OF_MOVE
cid#1632251 COPY_INSTEAD_OF_MOVE
cid#1632250 COPY_INSTEAD_OF_MOVE
cid#1632249 COPY_INSTEAD_OF_MOVE
cid#1632248 COPY_INSTEAD_OF_MOVE
cid#1632247 COPY_INSTEAD_OF_MOVE
cid#1632246 COPY_INSTEAD_OF_MOVE
cid#1632245 COPY_INSTEAD_OF_MOVE
cid#1632244 COPY_INSTEAD_OF_MOVE
cid#1632243 COPY_INSTEAD_OF_MOVE
cid#1632242 COPY_INSTEAD_OF_MOVE
cid#1632241 COPY_INSTEAD_OF_MOVE
cid#1632240 COPY_INSTEAD_OF_MOVE
cid#1632239 COPY_INSTEAD_OF_MOVE
cid#1632238 COPY_INSTEAD_OF_MOVE
cid#1632237 COPY_INSTEAD_OF_MOVE
cid#1632236 COPY_INSTEAD_OF_MOVE
cid#1632235 COPY_INSTEAD_OF_MOVE
cid#1632234 COPY_INSTEAD_OF_MOVE
cid#1632233 COPY_INSTEAD_OF_MOVE
cid#1632232 COPY_INSTEAD_OF_MOVE
cid#1632231 COPY_INSTEAD_OF_MOVE
cid#1558073 COPY_INSTEAD_OF_MOVE
cid#1557945 COPY_INSTEAD_OF_MOVE
cid#1557916 COPY_INSTEAD_OF_MOVE
cid#1557898 COPY_INSTEAD_OF_MOVE
cid#1557808 COPY_INSTEAD_OF_MOVE

Change-Id: Ibf417c154255fe3b0598127df5b5805ed543c8d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174660
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-10-08 13:16:08 +02:00
Eike Rathke
d65ccee291 Related: tdf#161599 ChildAccess::asValue() must return Reference<XInterface>
... otherwise the unotools/source/config/configitem.cxx
ConfigItem::impl_packLocalizedProperties() checking for
(getValueTypeName() == "com.sun.star.uno.XInterface") would not
hit and thus not pack the properties, returning just the useless
XWeak pointer as property.

This in ScUnoAddInCollection::ReadConfiguration() lead to English
names not being extracted from configured Add-Ins' DisplayName or
CompatibilityName, nor any CompatibilityName added to the list.

Fallout from

    commit bc70f674c2
    CommitDate: Sun Jun 18 08:41:27 2023 +0200

        Use getXWeak in configmgr

Change-Id: Ibaab8c08a06113b27ceffe1c45ef548c1d6fa225
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172476
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
2024-08-27 21:09:35 +02:00
Stephan Bergmann
e8358d0a0f Keep around a single configmgr::Components::WriteThread instance
...instead of joining and later re-spawning one.  This helps with the current
Emscripten setup (see 5b1df7709d "Document the
Emscripten threads issue"), and probably doesn't matter much either way on other
platforms (so just get it in unconditionally).  (Renaming the delay_ member
variable to delayOrTerminate_, to make its overall role more clear.)

(I ran into this when trying to turn the Emscripten build from starting up with
a Writer document to starting up with the start center, and then manually
opening a new Writer document.  The resulting different usage scheme happened to
exhaust our current -sPTHREAD_POOL_SIZE=4 pool quickly, so this is one of
multiple commits to address that.)

Change-Id: I1bd28604b4640d2afad982bfd82b1acee8200e26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170993
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-07-25 09:51:52 +02:00
Stephan Bergmann
8cdf186fac Remove bExitWasCalled-handling from confgimgr::Components dtor
That code had been added with 9fa4eff9be
"profilesafe: Enhancements to BackupFileHelper", but it looks dubious:

For one, I cannot find proof for the claim that MSVC would run destructors of
static objects upon _exit.  Building a simple C++ test program

> #include <iostream>
> #include <stdlib.h>
> struct S { ~S() { std::cerr << "hello\n"; } };
> S s;
> void f() { _exit(1); }
> int main() { f(); }

with contemporary MSVC 17.10 and executing it shows no "hello" stderr output
(see
<https://gcc.godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:c%2B%2B,selection:(endColumn:13,endLineNumber:5,positionColumn:13,positionLineNumber:5,selectionStartColumn:13,selectionStartLineNumber:5,startColumn:13,startLineNumber:5),source:'%23include+%3Ciostream%3E%0A%23include+%3Cstdlib.h%3E%0Astruct+S+%7B+~S()+%7B+std::cerr+%3C%3C+%22hello%5Cn%22%3B+%7D+%7D%3B%0AS+s%3B%0Avoid+f()+%7B+_exit(1)%3B+%7D%0Aint+main()+%7B+f()%3B+%7D%0A'),l:'5',n:'1',o:'C%2B%2B+source+%231',t:'0')),k:32.19670284753087,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:vcpp_v19_40_VS17_10_x64,filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'0',trim:'1',verboseDemangling:'0'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:c%2B%2B,libs:!(),options:'',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1),l:'5',n:'0',o:'+x64+msvc+v19.40+VS17.10+(Editor+%231)',t:'0'),(h:output,i:(compilerName:'x86-64+clang+18.1.0',editorid:1,fontScale:14,fontUsePx:'0',j:1,wrap:'1'),l:'5',n:'0',o:'Output+of+x64+msvc+v19.40+VS17.10+(Compiler+%231)',t:'0')),k:67.80329715246913,l:'4',m:100.00000000000001,n:'0',o:'',s:1,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4>).

If there indeed were issues with MSVC and non-standard _exit, a solution might
be to use standard _Exit instead (in FatalError in desktop/source/app/app.cxx).

And for another, when bExitWasCalled was true in
configmgr::Components::~Components, it would still have called
writeThread_->join() (i.e., it would potentially still have called
writeModFile from within configmgr::Components::WriteThread::execute()), but (a)
only after waiting out its full

> delay_.wait(std::chrono::seconds(1));

(because it missed to call configmgr::Components::WriteThread::flush, which
calls delay_.set()), and (b) potentially running into a deadlock because it
called writeThread_->join() with *lock_ locked, which
configmgr::Components::WriteThread::execute wants to lock too.

(I came across this because it got into my way when trying to adapt the
lifecycle of configmgr::Components::WriteThread to the needs of the Emscripten
build.)

Change-Id: Icb4ebf00d1d316b80c29f7bd91b86614ef4ac430
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170940
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-24 22:15:30 +02:00
Stephan Bergmann
c28c61e528 Revert "boost::unordered_map to std::unordered_map in configmgr::Partial"
This reverts commit 154b204010, which is known
broken, as (unlike for boost::unordered_map) there is no guarantee that
std::unordered_map works for incomplete value types, and indeed there is build
environments that started to fail now with

> In file included from /home/libo/src/core/configmgr/source/partial.cxx:23:
> In file included from /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/set:60:
> In file included from /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:63:
> In file included from /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_algobase.h:64:
> /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_pair.h:218:11: error: field has incomplete type 'configmgr::Partial::Node'
>       _T2 second;                ///< The second member
>           ^
[...]

Change-Id: Ie8d041bcf3d3b1b6aeede73adbaf14676250c4bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170467
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-14 17:32:17 +02:00
Noel Grandin
154b204010 boost::unordered_map to std::unordered_map in configmgr::Partial
Change-Id: I030a175af694d1e0025ac2c047141913b08c3be4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170395
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-13 18:49:04 +02:00
Noel Grandin
3c5d5d8ae3 no need to convert from Sequence to std::set here
we are never actually going to need a set, so just iterate over
the Sequence

Change-Id: I0de6ff9e0661227a69b7fbe6cccc5268f9eba58f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167430
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-10 10:44:13 +02:00
Noel Grandin
b667543a2a loplugin:ostr in configmgr
Change-Id: If1caaee8e54b5861e1435e900b3ae7bd90ecae5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167237
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-05-07 08:46:04 +02:00
Noel Grandin
b7d3e9ce25 speedup configmgr::Access on Windows
std::multiset seems to be pretty slow to construct and
destruct, even if we ~never put anything into these listener
lists, so rather use o3tl::sorted_vector, which has more
predictable performance.
Shaves 10% off startup time for me.

Change-Id: I13afcbe3cb63522e4efe61c64f773e1ffbec9683
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167101
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-04 12:27:49 +02:00
Michael Stahl
8350404ec1 configmgr: fix parse error if subelements of <info> used
The unused but valid child elements of <info> such as <author> may be
used by exentions. This fails with:

  warn:configmgr:15104:10916:configmgr/source/components.cxx:660: error reading "file:///instdir/program/../share/uno_packages/cache/uno_packages/....xcs" com.sun.star.uno.RuntimeException message: "bad member <component> in ....xcs at configmgr/source/xcsparser.cxx:289"

Because ending the first such element sets bIsParsingInfo_ to false.

This fix just concatenates all the characters in all the children,
should work well enough for extensions.

(regression from commit db3078bd8c)

Change-Id: I17a3fb7014cd34c1d546701036550085365432a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165143
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-03-22 08:46:04 +01:00
Stephan Bergmann
3ba85b7786 Support o3tl::iterateCodePoints with both sal_Int32 and std::size_t
...and clean up the most gross casting offenses

Change-Id: If0d646fb3e73e71a9a2735569395034973563a1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-09 19:19:04 +01:00
Noel Grandin
7840effb1d use more string_view
found by tweaking the stringview loplugin

Change-Id: I92203ba99642bef7951ffa146184c5562cb31d09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163744
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-08 07:06:13 +01:00
Stephan Bergmann
467eeda66e Fix placement of comments
...which each pertain to all the preceding code that extracts numbers from
strings, and where 0a5d4dc25c "elide some OString
temporaries" had changed that preceding code from stretching over a single to
stretching over multiple statements each

Change-Id: I315187465d64f620b1ddea8a0cc74ed5f8dc113b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163063
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-06 22:43:18 +01:00
Noel Grandin
0a5d4dc25c elide some OString temporaries
Change-Id: I2ecb6af11c95605c84e935b850fe94a1831a1497
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163043
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-06 17:07:23 +01:00
Noel Grandin
7ee4ea5c09 reduce unnecessary OString temporaries
spotted while profiling tdf#108037

Change-Id: I66afa79d7da94c1d3c7d1695ce9c5cf902e1429e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163002
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-05 15:10:52 +01:00
Mike Kaganski
0fa827dbb2 Drop std::as_const from css::uno::Sequence iterations
Obsoleted by commit 2484de6728 (Remove
non-const Sequence::begin()/end() in internal code, 2021-10-15) and
commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27 12:43:48 +01:00
Stephan Bergmann
f8199c4244 tdf#158593 Make configmgr READONLY Property more useful
...to reflect whether or not the corresponding item can be modified.  Which
matches what the READONLY flag is actually used for today.  (And the original,
somewhat arbitrary semantics had been assigned without much thought, IIRC, and
it should be OK to change them.)

Change-Id: I8185e47519a5cb4aff6e8f260326845276b0c092
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160957
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-19 07:57:32 +01:00
Caolán McNamara
9c22c643ff cid#1558833 Uninitialized scalar field
Change-Id: I8c617c20f725f4277a0c4d637be336c6624c3238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160513
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-09 21:30:41 +01:00
Samuel Mehrbrodt
030b72df0a tdf#157432 Expert config: Allow filtering by changed values
Change-Id: Ib8bbb7fc9e8014a9367278f3fa640f53af46dd2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159986
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-12-07 08:03:36 +01:00
Stephan Bergmann
3ff66d4361 Simplify implementation of getTypeByHierarchicalName
(Localized)PropertyType::getStaticType already provides the relevant information

Change-Id: I5aceb596ac4a2d111ebcb5ddef7ef74c80762047
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159969
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-26 13:19:56 +01:00
Stephan Bergmann
8ac9ef88ce Simplify description/type parsing a bit
...it only pertains to property nodes

Change-Id: I706e14118e3f8c33190821f9bcce81bd60d665e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159953
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-25 23:10:06 +01:00
Noel Grandin
06654099e9 asan: fix read of uninitialised value
ever since
    commit a91892ec49
    Author: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
    Date:   Thu Nov 16 13:56:06 2023 +0100
    Use existing types, instead of strings

Change-Id: Ifb7af17d21a32fdf411854b6820b32d1767660e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159779
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-21 17:59:51 +01:00
Samuel Mehrbrodt
a91892ec49 Use existing types, instead of strings
as suggested in https://gerrit.libreoffice.org/c/core/+/158028/comments/b7a803f4_7e5899ca

Change-Id: I7d4c46b24307922b51e463bacdfacfca85956b80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159524
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-11-20 11:17:23 +01:00
Stephan Bergmann
8ef2b4b4c6 Extended loplugin:ostr: configmgr
Change-Id: If9cc1f0c18a5fa344a433b338f81d191340e70f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159722
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-20 08:53:42 +01:00
Samuel Mehrbrodt
700ac29771 Use proper type in expert config dialog
In preparation for proper editing support for the different types.

Change-Id: I7044ff100c9bfcca5fa8894ff4525a1aac692796
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158028
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-11-09 15:37:16 +01:00
Samuel Mehrbrodt
db3078bd8c tdf#157431 Show description for expert config items
Change-Id: I7d0257c2e06ed384f90ca3b51a6d2549044f2cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157148
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-11-09 08:14:38 +01:00
Noel Grandin
0e08992f99 reduce ref-counting traffic in configmgr
we can return by const& from getNode

Change-Id: If93c43fd2e910e2fb69d9bd0a9e3dc587133dfa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158729
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-31 18:11:02 +01:00
Noel Grandin
300763ddf6 reduce reference counting traffic in configmgr
no need to construct a vector when iterating over children

Change-Id: I717e92be3c576a6e5d877f4333264a5bed9daadf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158728
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-31 18:10:30 +01:00
Stephan Bergmann
826d673ac8 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: configmgr
Change-Id: Id95245a309b3baa80d7cca63d980aa0657fb9eb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158148
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-19 13:54:29 +02:00
Noel Grandin
af8ee87852 SAL_WARN->SAL_INFO in Access::getChild
reduce log noise

Change-Id: I95393f18fe8cc019c89ad4779d5b10f64993bd51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156340
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-31 21:50:18 +02:00
Mike Kaganski
8e9b3abce9 Make sure that root listeners are notified first
The problem appeared when in a configuration listener's changesOccurred,
a configuration value was read using officecfg machinery, which could
return the old value of the configuration, or an updated one, at random.

This was caused by use of a cached value in
comphelper::detail::ConfigurationWrapper::getPropertyValue, which is
cleaned in ConfigurationChangesListener::changesOccurred; but the order
in which the listeners' changesOccurred methods were called depended on
the implementation detail of configmgr::Components::roots_, which was
previously a std::set of pointers, and now is a sorted vector. This
made the pointers sorted in order of the pointers' addresses (basically
random), and when a broadcaster's common list of change listeners was
prepared in Components::initGlobalBroadcaster, ConfigurationWrapper's
listener could arrive last. This meant, that the cache could be cleaned
too late, after its obsolete content was already used in a previous
listener.

The problem could be partially mitigated by clearing the cache in the
comphelper::detail::ConfigurationWrapper::setPropertyValue, but that
would only handle cases of config modifications using comphelper.

Instead, take into account that ConfigurationWrapper listens on the
root of configuration tree; and introduce a separate container in
configmgr::Broadcaster for root listeners. They would be triggered
first, before all other listeners.

Still, this would not guarantee the proper order, if another listener
is registered on root. To handle all cases, a special listener category
could be used, which could be filled using a dedicated internal API, so
comphelper could use it to register its privileged listener close to
the heart of the broadcaster :) This might be implemented later.

Change-Id: I956b7989b3927dca2683f63cf92b0dda04db9bdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154561
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-18 06:54:47 +02:00
Mike Kaganski
bc70f674c2 Use getXWeak in configmgr
Change-Id: Ia7d9475cecd2208ccf672f2b35c0c841fed7f4dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150840
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-18 08:41:27 +02:00
Noel Grandin
e810bd2b99 merge some stringadds
found with a lightly tweaked version of the loplugin:stringadd
and some hand-holding.

Change-Id: I146aadcaf665e98fea89a9cad2df4dc3935622f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152275
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-25 18:43:52 +02:00
Stephan Bergmann
72b869d1c0 Fix CppunitTest_configmgr_unit for --disable-report-builder
...after abd630e81b "Allow all hierarchical path
segments to be ['...'] quoted", which failed as the checked
MimeTypeClassIDRelations group is conditional on install:module="reportbuilder".
(See the comments at
<https://gerrit.libreoffice.org/c/core/+/151673/2#message-f029dd1877f8a946647456ed73a7b60f6dfc0e8f>
"Allow all hierarchical path segments to be ['...'] quoted".)

It looks like there is no other, non-conditional property with a slash in its
name, so the test now just tests the ['...'] syntax on an otherwise
unproblematic property name.  (Alternatively, we could have extended the
configuration data used by unit tests with such a problematicaly named
property.)

Change-Id: I820004a5b824326d86e67c158994f13e71ba135e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152184
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-24 14:53:26 +02:00
Stephan Bergmann
abd630e81b Allow all hierarchical path segments to be ['...'] quoted
...and not just set elements.  <https://gerrit.libreoffice.org/c/core/+/151660>
"tdf#104005 Don't allow changing finalized properties" found that some existing
property names include "/", which makes them unusable with e.g.
getPropertyByHierarchicalName.

The most obvious solution is to allow ['...'] quoting (without a leading
template name, though) for all kinds of hierarchical path segments.  (In theory,
that would cause backwards incompatibility, as e.g. a property named ['foo']
could no longer be referenced by a ['foo'] path segment (it would need to be
referenced by a ['[&apos;foo&apos;]'] path segment instead).  But in practice,
that path segment ['foo'] would have been rejected in the past anyway, as it did
not reference a set element.)

To make this work, the meaning of the setElement out-parameter of
configmgr::Data::parseSegment is changed to only be true if the segment uses
['...'] notation including a leading (non-empty) template name.

What this change does not (yet) address is writing out such quoted (group or
set) names in the hierarchical paths written out in configmgr::writeModFile,
where necessary.  (It never writes out names of properties as parts of
hierarchical names, so this wouldn't be an issue for the existing problematic
properties containing "/" in their names, anyway.)

Change-Id: I635d823c7bbb6b8ac5869c7e0130ba8cfd329599
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151673
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-11 16:49:00 +02:00
Noel Grandin
a33922e38b optimise find/insert calls to maps
Instead of doing two lookups, we can just call insert and
then update the mapped-to value if the insert actually succeeded.

Change-Id: I3df3b98f0debe6bf74c739dd5850e7714d9c2789
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151030
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-28 08:23:04 +02:00
Stephan Bergmann
7c36c5fdfd Some missing XServiceInfo implementations
Change-Id: I1cf871b40f9f4020147dac0456ebeed3de0438e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150533
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-18 07:38:29 +02:00
Noel Grandin
637cceeefb loplugin:stringadd in c*
after my patch to merge the bufferadd loplugin into stringadd

Change-Id: I66f4ce2fd87c1e12eefb14406e0e17212f68ceff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149497
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-24 15:29:18 +00:00
Uday Sharma
0d8d0fb893 tdf#143148: Use pragma once instead of include guards
Change-Id: I6898acbf7c6c9de45bbfa6a32202acf302f92caa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146822
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-03-16 09:25:32 +00:00
Stephan Bergmann
e149f038b6 Bump dconf minimum version requirement
At least building on Fedora 37 with dconf-devel-0.40.0-7.fc37.x86_64 against
recent LLVM 17 trunk libc++ started to fail now with

> In file included from configmgr/source/dconf.cxx:25:
> In file included from /usr/include/dconf/dconf.h:23:
> In file included from /usr/include/dconf/common/dconf-enums.h:23:
> In file included from /usr/include/glib-2.0/glib.h:34:
> In file included from /usr/include/glib-2.0/glib/gasyncqueue.h:34:
> In file included from /usr/include/glib-2.0/glib/gthread.h:34:
> In file included from /usr/include/glib-2.0/glib/gatomic.h:30:
> In file included from /usr/include/glib-2.0/glib/glib-typeof.h:44:
> In file included from ~/llvm/inst/bin/../include/c++/v1/type_traits:430:
> ~/llvm/inst/bin/../include/c++/v1/__type_traits/aligned_union.h:23:1: error: templates must have C++ linkage
> template <size_t _I0, size_t ..._In>
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> configmgr/source/dconf.cxx:19:1: note: extern "C" language linkage specification begins here
> extern "C" {
> ^

because the missing extern "C" has meanwhile been added to upstream dconf with
<f860ddcc6a>
"common: Add missing G_BEGIN/END_DECLS" towards tag 0.40.0.

So the easiest fix here appears to be to bump our requirements to that dconf
version 0.40.0:  The one case I'm aware of that explicitly wants dconf support
is downstream Fedora and RHEL builds, which already have dconf 0.40.0
(cf. most recent
<a9987b0abe/f/dconf.spec (_4)>
for f37 and most recent
<1bb6b46da2/dconf.spec (L4)>
for e9s).  On the other hand, the TDF Linux release builds are done with an
explicit --disable-dconf in distro-configs/LibreOfficeLinux.conf (since
ecc617e797 "configmgr: support reading from a
dconf layer (WIP)") and the Flatpak builds on Flathub are done against an
org.freedesktop.Sdk//22.08 where no dconf support is detected at all (for the
most recent LO 7.5.1 build on Flathub see

> checking for DCONF... no
> checking whether to enable dconf... no

at <https://buildbot.flathub.org/#/builders/5/builds/3184/steps/8/logs/stdio>
for aarch64 and at
<https://buildbot.flathub.org/#/builders/5/builds/3184/steps/8/logs/stdio> for
x86_64).

Change-Id: I559d2ac8712dbe2b40c9b881314b88d1cc8eaf43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-15 08:23:36 +00:00
Noel Grandin
12c00caa3d unlock during dispose in configmgr::configuration_provider::Service
Since the code that can run during flushModifications might manage to
call back into Service..

regression from
    commit a61951a3a2
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Mon Feb 20 20:08:30 2023 +0200
    BaseMutex->std::mutex in configmgr::configuration_provider::Service

Change-Id: I0070e7589cdea38905de6c68adefd8081b122152
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147500
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-23 12:13:42 +00:00
Noel Grandin
00194781ef fix locking in configmgr::configuration_provider::Service
a mistake from
    commit a61951a3a2
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Mon Feb 20 20:08:30 2023 +0200
    BaseMutex->std::mutex in configmgr::configuration_provider::Service

Change-Id: I59c670ea7bffacb9dcd1f073b5da2439c2102a45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147392
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-21 11:58:51 +00:00
Noel Grandin
a61951a3a2 BaseMutex->std::mutex in configmgr::configuration_provider::Service
Change-Id: Ie8f7cb4cd91ac0089365a691f07962a26d51a72a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147377
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-21 09:12:17 +00:00
Stephan Bergmann
302a22cd19 Verify that zh-Hant-TW locale works in configmgr as intended
...after b52117c0be "Try an override locale as
first fallback"

Change-Id: I23d8459fff4d76fd9d542d098953bf97cf5397a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147219
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-17 18:56:56 +00:00