Commit Graph

247 Commits

Author SHA1 Message Date
wmayer
f0740edd20 App: [skip ci] AddressSanitizer: heap-use-after-free
In Document::removeObject() do not access object after it has been possibly deleted
2021-02-23 14:30:00 +01:00
Chris Hennes
0a4ff764e9 LGTM: Move seq->next out of loop control
LGTM points out that the construct use in the loop here "does
nothing" -- that is, it is a conditional whose result is never used.
It is apparently being used simply to ensure that the next() function is
called on each loop iteration, but because sequence may be null, it is
shoehorned into a trinary :? operator. To clarify the intent and ensure
that later readers (including LGTM) do not misunderstand it,
this code is broken out into a more standard conditional construct at
the end of each loop iteration.
2021-02-11 12:31:25 +01:00
Abdullah Tahiri
05ccc95cde App/Gui: New restoreError Document status and Gui pop-up
========================================================

If the restore of Document.xml results in invalid Document.xml (because unhandled exceptions occurred), the
document status Document::restoreError is set. The GUI or Mod/Web if a link was clicked, show a pop-up indicating
this situation.

This commit also shows an appropriate pop-up for the partialRestore when opening from the menu, that before only
appeared when opening by clicking a link.
2021-01-24 16:43:20 +01:00
wmayer
eac4062b3f Boost: [skip ci] Fix build warnings from deprecated Boost headers (v1.75) 2020-12-29 15:34:25 +01:00
luz paz
84553bf191 App: Fix header uniformity, trailing whitespace, and doxygen headers 2020-11-19 13:38:37 +01:00
wmayer
cd0dfe1e87 App: [skip ci] fix printing warning for recursive calls of Document::_commitTransaction 2020-10-23 20:50:23 +02:00
wmayer
fbcf8dfa5d App: [skip ci] fix possible segmentation fault when performing a transaction after an undo 2020-10-23 19:47:33 +02:00
Zheng, Lei
b2624c08a1 App: fix recursive App::getLinksTo() 2020-09-27 12:59:38 +02:00
Zheng, Lei
f67d960146 App: record transaction on non DocumentObject
Related #0004265
2020-09-04 16:01:21 +02:00
wmayer
a7738cec07 App: [skip ci] for a recompute do not report every exception as error
There are a lof of scenarios where it's not possible to perform an operation without throwing an exception. Reporting an exception as error is not only annoying but often confusing because the user assumes he did something wrong.
So, for the moment many of these exceptions are reported as log messages but serious things like memory exception, std. C++ exceptions or unknown C++ exceptions are still reported as errors
2020-07-31 13:59:40 +02:00
wmayer
89f997a289 Coverity: Use after free (_removeObject may delete the DocumentObject) 2020-07-20 17:34:24 +02:00
wmayer
02f45721d6 PVS: V529 Odd semicolon ';' after 'for' operator. 2020-07-18 10:59:27 +02:00
Zheng, Lei
36d046d489 App/Gui: introduce temporary document
Add new argument to Application::newDocument() to create a temporary
    document. Also exposed to Python API App.newDocument() with a named
    argument 'temp'.

    The temporary document is marked with status bit 'TempDoc'. The user
    will not be prompt for saving when closing. The undo/redo is disabled.
    The AutoSaver skips it. And the tree view will not show it.
    PropertyXLink allows linking to/from object within a temporary document
    without saving.
2020-07-14 19:36:05 +02:00
luz.paz
ef37cc3930 Fix typos [skip-ci]
Found via codespell v1.18.0.dev0  
```
codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml
```
2020-06-29 20:52:23 +02:00
wmayer
d21cd009b1 App: extend Document::findObject to allow to search by label 2020-06-27 15:58:23 +02:00
wmayer
d6169d6478 boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00
wmayer
1f7818f977 Gui: [skip ci] show program version a file was created with in project information dialog 2020-06-14 17:52:02 +02:00
Abdullah Tahiri
94fda2ec89 Document/DocumentObject: onUndoRedoFinished()
=============================================

New mechanism for on-demand signaling of undo/redo transaction finalisation.

The mechanism consists of:
1) A status bit that is set, when an object should receive this signaling (e.g. because changes during transaction have been inhibited)
2) The new function to be called by the Document undo/redo actions when the transaction is over (for those objects having the status bit set).

Note 1: The undo/redo signals are now outside the undoing FlagToggler, this means that:
1) a call to isPerformingTransaction will return false.
2) a recompute the slot of such a signal will not be inhibited.

Note 2: The undo/redo signals are called once the documentobjects that requested to be notified after the trasaction is over have been notified.
The consequence is that the viewprovider can rely on the documentobject having a correct status.

I think that the behaviour of Note and Note 2 is the wanted behaviour of this signals, I cannot rule out that other parts of FC rely on the old
implementation.
2020-06-14 14:44:28 +02:00
wmayer
730154a684 boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated 2020-06-12 17:51:33 +02:00
wmayer
f317f05837 App: [skip ci] handle XMLAttributeError in Document::readObjects 2020-06-07 14:25:32 +02:00
wmayer
d2e3045923 App: [skip ci] in dependency graph make sure that an Origin stays inside the Body or Part container 2020-06-06 13:48:25 +02:00
wmayer
6cbf93dd5f App: [skip ci] suppress false warning 2020-06-06 10:54:16 +02:00
Zheng, Lei
d70ddf692e App: make deleting dynamic property safer
Dynamic property can be removed at any time, even during triggering of
onChanged() signal of the removing property. This patch introduced
static function Property::destroy() to make it safer by queueing any
removed property, and only deleting them when no onChanged() call is
active.
2020-03-21 15:43:03 +01:00
plgarcia
59269207b4 Change backup policy
1 - Reports the error to the user in a popup.
2 - Names of the backups include the timstamp instead of a number. Names have more sense and the files can be sorted by names what is also the age order.
3 - Behaviors when changing configuration improved, the number of files present on the system was not reduced when reducing the number of backups or backups deactivated.
2020-02-24 23:06:26 +01:00
wmayer
2336d1be8d App: refactor code to support various backup policies 2020-02-24 23:06:26 +01:00
Zheng, Lei
72833466a0 App: do not save external dependency 2020-02-14 19:46:47 +01:00
Zheng, Lei
b50914923a App: add class TransactionLocker
To protect some critical transaction from being closed prematurely. It
is currently used to protect transaction of object deletion.
2020-02-11 15:40:27 -05:00
luz.paz
019f73852c src/App: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/App` files
2019-12-25 11:38:43 +01:00
luz.paz
30a717beac Fix typos and misc. formatting [skip ci]
Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml`
2019-10-21 16:02:23 -03:00
Zheng, Lei
c26081f7dc App: fix Document::isTransactionEmpty() 2019-10-08 10:22:51 +02:00
Zheng, Lei
2df3052ecf Gui: add new API ViewProviderDocumentObject::allowOverride()
This API is used to delcare if a view provider can be used as an
override for a give object.

Conflicts:
	src/App/DocumentObject.h
2019-10-06 17:22:57 +02:00
luz.paz
d4e381d846 Crowdin: Fix creative common license name
Source: https://crowdin.com/translate/freecad/549/en-sv#6498160
2019-10-05 17:27:48 +02:00
luz.paz
fb32601746 Fix various (doxy) typos and whitespace issues
Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml`
2019-10-03 07:57:13 +02:00
Zheng, Lei
38c47d6e95 Expression: split Expression.h to ExpressionParser.h
Split Expression details into a separate header to reduce recompilation
time on changes.
2019-09-28 15:30:41 +02:00
Zheng, Lei
d1b5e07eee App: improve exception handling in FeaturePython 2019-09-27 18:02:20 +02:00
wmayer
9fa56345cf core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
wmayer
1cdd2d166f Add virtual method allowOverrideViewProviderName to DocumentObject to indicate if a DocumentObject's view provider type can be overriden.
For most object types this is not allowed to avoid to create incompatible combinations via Python or manipulated project files and possibly provoke crashes.

For more details see also: https://forum.freecadweb.org/viewtopic.php?f=10&t=38970&p=333951#p333951
2019-09-14 00:52:09 +02:00
wmayer
7c83a2d05d fix regression caused by commit 469e3b5bf 2019-09-13 13:08:48 +02:00
Zheng, Lei
99311c25a8 App: improve document::readObjects() 2019-09-10 14:17:06 +02:00
wmayer
3be856db27 minor change 2019-09-07 17:08:40 +02:00
Zheng, Lei
d4a83a9b52 App: check active document before revert in Document::restore() 2019-09-07 17:00:25 +02:00
Zheng, Lei
f90afabac4 App: call setActiveDocument when reverting document 2019-09-07 17:00:03 +02:00
Jean-Marie Verdun
9a007cfbc4 Fix copyright 2019-09-03 17:21:11 +02:00
Jean-Marie Verdun
dda591ec6e Fix some copyright issues reported by luzpaz
Fix some typos reported by kkremitzi
Remove resetTouched which was dead code following update on Document management
2019-09-03 17:21:08 +02:00
Jean-Marie Verdun
a2e21f79f2 Add initial version of the Cloud workbench 2019-09-03 17:21:05 +02:00
luz.paz
7af7c10cf1 Fix misc. typos, whitespace, and http:// to https:// issues 2019-09-03 11:11:43 -03:00
Zheng, Lei
52d30b4053 App: fix Document::_abortTransaction() 2019-08-30 14:55:49 +02:00
Zheng, Lei
0e115be0ec App: make recompute aborting optional 2019-08-30 14:41:46 +02:00
Zheng, Lei
15b61112b1 App: prevent recursive abort/commitTransaction 2019-08-30 14:35:23 +02:00
Zheng, Lei
b59e4ad9a5 App: do not throw on recursive recompute 2019-08-17 15:32:51 +02:00