Commit Graph

82 Commits

Author SHA1 Message Date
Pieter Hijma
1f3e7bc0da Core: Maintain the lock while reading config file 2024-05-17 11:29:49 +02:00
wmayer
459b4d2c36 Core: Fix possible race conditions when reading or writing config file 2024-05-06 13:24:17 +02:00
wmayer
6e55cd1c3a Base: Fix possible race condition when restarting the application
When restarting the application (e.g. after installing an addon) the application will be closed and a new instance will be launched. Now it can happen that the old instance is still busy writing the config files to disk while the new instance wants to read them in. At this time it's possible that a config file is in an invalid state so that the new instance will ignore it but then starts with a default configuration.
Later when closing the new instance the config files will be overwritten and destroy the user's original settings.

By using a lock file this race condition will be avoided. It uses a timeout of 1 second that should be enough for the old instance to write the files to disk.
2024-04-18 23:07:58 -05:00
wmayer
757d564a7c Tests: add more unit tests for ParameterGrp 2024-04-17 21:45:26 +02:00
wmayer
9fb2931781 Base: fix some linter warnings 2024-04-14 21:22:08 +02:00
wmayer
0b08ea3368 C++: replace deprecated vsprintf and sprintf
With future C++ compilers the methods vsprintf and sprintf are declared as deprecated due to security issues.
They are replaced with the secure counterpart of the fmt library

Fixes the compiler warnings -Wdeprecated-declarations
2024-04-03 10:04:56 +02:00
Ladislav Michl
95b37fa806 Base: Do not use else before return 2024-01-21 16:14:12 +01:00
wmayer
08b10cd287 fix cppcoreguidelines-*
* cppcoreguidelines-init-variables
* cppcoreguidelines-c-copy-assignment-signature
* cppcoreguidelines-macro-usage
* cppcoreguidelines-non-private-member-variables-in-classes
* cppcoreguidelines-pro-type-member-init
* cppcoreguidelines-slicing
* cppcoreguidelines-special-member-functions
* cppcoreguidelines-virtual-class-destructor
2023-11-16 01:22:09 +01:00
wmayer
39337ea12e fix bugprone-*
* bugprone-throw-keyword-missing
* bugprone-unhandled-self-assignment
* bugprone-suspicious-string-compare
* bugprone-reserved-identifier
* bugprone-narrowing-conversions
* bugprone-macro-parentheses
* bugprone-implicit-widening-of-multiplication-result
* bugprone-exception-escape
* bugprone-copy-constructor-init
2023-11-16 01:22:09 +01:00
wmayer
5c306f6e2a fix readability-*:
* readability-uppercase-literal-suffix
* readability-named-parameter
2023-11-16 01:22:08 +01:00
wmayer
f539138dd9 fix readability-*:
* readability-const-return-type
* readability-container-data-pointer
* readability-container-size-empty
* readability-delete-null-pointer
* readability-else-after-return
* readability-inconsistent-declaration-parameter-name
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-redundant-string-cstr
* readability-use-anyofallof
* readability-static-definition-in-anonymous-namespace
* readability-static-accessed-through-instance
* readability-simplify-boolean-expr
2023-11-16 01:22:08 +01:00
wmayer
e85c383bff Base: apply clang format 2023-11-13 12:01:26 -05:00
wmayer
56820718c5 Core: Revert superfluous changes made with PR #9521 2023-10-09 15:06:45 +02:00
AgCaliva
5f8426d7a7 fix parameter 2023-08-31 01:03:51 -03:00
AgCaliva
4062d9b06a fix merge 2023-08-30 17:59:41 -03:00
AgCaliva
39dcb1da7b Merge Master 2023-08-30 16:24:16 -03:00
mosfet80
d453672ab8 [BASE] Removed dead code (#10330) 2023-08-28 10:41:20 -05:00
wmayer
010dca8303 Base: C++ core guidelines: init variables 2023-08-24 18:48:52 +02:00
wmayer
4fb07bcfd6 Base: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
wmayer
93d878c0ca Lint: fix several issues discovered by clang-tidy 2023-08-18 08:44:49 -05:00
wmayer
2bc90e6090 Base: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
wmayer
367cdb36ed Base: modernize C++: use range-based for loop 2023-08-14 14:09:29 +02:00
wmayer
9f456d712b modernize C++: use equals delete 2023-08-10 17:29:05 +02:00
AgCaliva
0c4ef0e106 merge master 2023-08-08 23:29:40 -03:00
wmayer
0af4990817 modernize C++: make unique 2023-08-07 19:51:30 -06:00
wmayer
d244dcf2da modernize C++: use nullptr 2023-08-05 11:23:12 -06:00
AgCaliva
52c55f59a8 Implementing agnostic version of ParameterGrp for reading XML, replacing XMLReader from src/Base/reader.cpp with new class DocumentReader 2023-06-16 15:36:43 -03:00
Zheng, Lei
7164674cb4 Base/App/Gui: force using Base::Handle for ParameterManager
For reference counting
2023-01-06 09:14:41 -06:00
berniev
87c3b58f44 Simplify switch statement (modded) 2022-12-04 19:37:04 +01:00
Zheng, Lei
d3c063f88c Base/App: add new signal interface to Parameter
Added new signal interface using boost::signals2 signalParamChanged.

Exposed to Python as ParameterGrpPy.AttachManager() to monitor changes
to all parameters, sub groups under the referring group.

Added new attribute for ParameterGrp(Py) to query the Parent and Manager
of the referring group.
2022-12-03 17:08:17 -06:00
berniev
58cb977c3b remove xcerces2 2022-09-09 08:02:35 +02:00
wmayer
7824d7b1df Base: fix several warnings reported by code analyzers 2022-08-02 13:04:50 +02:00
berniev
8aff4a7503 Base: Modernise ctors dtors defs etc 2022-08-02 12:37:46 +02:00
berniev
4043d049bc remove redundant void from Base 2022-07-31 14:10:34 +02:00
wmayer
0bef4e82f2 Fix several clazy issue:
* Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference]
2022-07-24 22:29:06 +02:00
Uwe
90abdf2752 [Base] remove some more superfluous nullptr checks 2022-07-18 13:07:16 +02:00
Uwe
bd6ffcc7e0 [Base] remove more superfluous nullptr checks 2022-07-18 03:29:03 +02:00
Uwe
53571f7196 [Base] remove superfluous nullptr checks 2022-07-18 03:16:22 +02:00
Zheng, Lei
3ef438eaf0 Fix mixed line endings 2022-04-26 12:52:55 -05:00
Chris Hennes
3b42d4afac Base: PR6497 move return statement to new line 2022-03-29 12:34:34 -05:00
wmayer
b47029998e Base: fix handling of path separators in parameter group names 2022-03-29 14:54:03 +02:00
wmayer
988a96b457 Base: make Parameter class less vulnerable for invalid user config files 2022-03-24 11:43:39 +01:00
wmayer
93f0c64704 Base: [skip ci] remove several superfluous static_cast 2022-03-24 11:27:55 +01:00
wmayer
882e34f2ce Base: modernize C++11
* use nullptr
2022-03-23 16:57:25 +01:00
Uwe
7bb7efc55f [Base] Parameter and Matrix: remove unused includes 2022-03-02 13:28:34 +01:00
wmayer
4d87039635 Base: modernize C++11
* remove redundant void-arg
* use nullptr
* replace deprecated headers
2022-01-25 20:21:30 +01:00
wmayer
9f2dd4a363 Base: [skip ci] Modify GetASCII to include empty strings 2021-10-23 22:56:45 +02:00
Chris Hennes
525a92cfc5 Modify GetASCIIMap to include empty strings 2021-08-20 20:04:19 -05:00
wmayer
b5c49a6b77 Base: allow to use the classes XUTF8Str and StrXUTF8 outside FreeCADBase 2021-04-28 10:56:17 +02:00
wmayer
eff0655d83 LGTM: [skip ci] fix: Wrong type of arguments to formatting function 2020-07-24 19:58:48 +02:00