Commit Graph

36 Commits

Author SHA1 Message Date
wmayer
b7bc6ad1e6 Gui: add security checks to view provider extensions because they can be accessed if a document objects is not yet attached 2024-04-09 22:15:51 +02:00
André Caldas
560898907b Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
wmayer
54bb9c9c62 Gui: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
berniev
656ef8961f Gui: redundant void 2 2022-08-08 10:21:44 +02:00
berniev
6ac4d8392e Gui: use emplace_back 2022-08-05 10:33:41 +02:00
wmayer
919271ed5e Gui: fix visibility of front nodes when moving an object to Part container 2022-05-30 03:21:52 +02:00
wmayer
96adb98f46 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
wmayer
1ca7429705 Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Uwe
9df800289b [Gui] ViewProviderFeature etc.: remove unused includes 2022-03-06 00:34:35 +01:00
luz paz
298c677873 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
Zheng, Lei
42c56d9fef Gui: fix restoring of geo feature group 2020-05-02 12:40:45 -04:00
luz.paz
f11783a498 src/Gui: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/Gui` files
2019-12-25 11:39:17 +01:00
Zheng, Lei
f0cb6d5885 Gui: fix GeoFeatureGroupExtension
The change in ViewProviderGeoFeatureGroupExtension.claimChildren() is
so that GeoFeatureGroupExtension.getSubObjects() can exclude non direct
children.
2019-08-30 15:45:21 +02:00
Kunda
d4769e7023 Misc. typo 2017-10-01 10:15:31 +02:00
Stefan Tröger
94248a6c42 Improve GeoFeatureGroup claim children algorithm and remove special Body impelmentation 2017-09-21 13:02:16 +02:00
wmayer
4b400fd986 rename status bit 'Delete' to 'Remove' as it fits better for its purpose, add new bit 'Destroy' 2017-09-13 15:47:48 +02:00
wmayer
e260f9dabd improve whitespaces 2017-09-09 18:07:46 +02:00
Stefan Tröger
71b7811495 Fix GeoFeatureGroup claimChildren in case some out-of-group item links to a child 2017-09-09 16:55:55 +02:00
Stefan Tröger
0439656133 Ensure that GeoFeatureGroup claims children when a parent of it is deleted. fixes #0003150 2017-09-09 16:55:55 +02:00
Stefan Tröger
6d40b1d646 Ensure viewprovider is shown after drop from claimChildren3D fixes #0003078 2017-09-09 16:47:07 +02:00
Stefan Tröger
2dc09c5e4d Tree: Adopt to special GeoFeatureGroup behaviours 2017-09-09 16:47:07 +02:00
luzpaz
928749d0a3 typo fix 2017-07-10 19:29:55 -03:00
wmayer
989fe4028e various fixes:
+ fix typos
+ fix const correctness
+ whitespace improvements
2017-06-19 17:18:16 +02:00
Stefan Tröger
aa0d25f54f Groups: Handle add and remove object correctly 2017-06-19 15:37:09 +02:00
Stefan Tröger
bdf981e770 Unify and fix group handling in geofeaturegroups 2017-06-19 15:37:09 +02:00
Stefan Tröger
f3358ad77a Fix drag&drop of geofeature groups. fixes #0002835 fixes #0002796 2017-06-19 15:37:09 +02:00
wmayer
5d21eb614b fix crash in ViewProviderGeoFeatureGroupExtension::getLinkedObjects 2017-02-01 12:04:41 +01:00
Stefan Tröger
109f8690ee Extensions: Fix GeoFeatureGroup drag&drop 2017-01-04 16:01:58 +01:00
Stefan Tröger
47ed29fffd Extensions: GeoFeatureGroup only for GeoFeature 2017-01-04 16:01:58 +01:00
wmayer
9ac1810ea3 Fix issues:
+ improve formatting
+ remove superfluous semicolons
+ comment unused parameters
+ rename Initialisation to Initialization
+ rename Deinitialisation to Finalization
+ remove spaces
2016-10-08 12:48:34 +02:00
Stefan Tröger
3a51404dd5 Extenions: Drop virtual inheritance
Due to problems onthe windows platform the virtual inheritance approach must be dropped. NExt to the already reimplemented proeprty interface the Type interface is reimplemented too. This change allows to revert some earlier changes.
2016-10-08 12:48:34 +02:00
Stefan Tröger
22fa3b3922 Extension: Fix order-of-initialisation crash
FreeCADs property system utilises some pointer math to calculate the offset between
property and base class. Due to virtual inheritance of th ePropertyContainer the memory
layout has been changed to rather random, which has lead to crashes dependend on the
order of object initialisation.

The solution is to not make PropertyContaner virtual but a class below, Base::Persitance.
Then the memory layout is random for Persistance, but it is perfectly aligned for the
base class chains from PropertyContainer onwards as well as from Extension onwards.
Hence the proeprty system was changed to take the offset always from those two.
2016-10-08 12:48:34 +02:00
Stefan Tröger
258be36aad Extensions: Handle new dynamic_cast's 2016-10-08 12:48:34 +02:00
Stefan Tröger
ed32752674 Extensions: Add ViewProvider extension python types 2016-10-08 12:48:34 +02:00
Stefan Tröger
fe32f03e63 Extension: Port ViewProvider of OriginGroup 2016-10-08 12:48:34 +02:00
Stefan Tröger
261798da2e Extensions: Port ViewProvider of GeoFeatureGroup 2016-10-08 12:48:34 +02:00