Commit Graph

1723 Commits

Author SHA1 Message Date
wmayer
057192f314 py3: fix several crashes 2017-06-04 11:12:53 +02:00
wmayer
729cfd8155 py3: fox compiler warnings
issue 0000995
2017-06-04 00:17:57 +02:00
Abdullah Tahiri
b4e942c08b Checking for Document Restoring when extension has a null property
==================================================================

The problem:

OriginGroupExtension::OriginGroupExtension () {

    initExtensionType(OriginGroupExtension::getExtensionClassTypeId());

    EXTENSION_ADD_PROPERTY_TYPE ( Origin, (0), 0, App::Prop_Hidden, "Origin linked to the group" );
}

initializes the Origin property to null.

Then Document::Restore => readObjects => addObject => slotNewObject => ViewProviderDocumentObject::updateView => ViewProviderBody::updateData => ViewProviderGeometryObject::updateData =>
ViewProviderDocumentObject::updateData => ViewProvider::updateData => ViewProviderOriginGroupExtension::extensionUpdateData => updateOriginSize() => OriginGroupExtension::getOrigin,

the latter throws an exception because the origin property is null.

Afterwards, the origin property is initialized during Document::Restore => readObjects => ExtensionContainer::Restore() => PropertyContainer::Restore() => App::PropertyLink::Restore()
=> App::PropertyLink::setValue() => Property::hasSetValue, which triggers an onChange: Body::onChanged => BodyBase::onChanged => Feature::onChanged => DocumentObject::onChanged =>
Document::onChangedProperty => Document::slotChangedObject => ViewProviderOriginGroupExtension::slotChangedObjectGui => ViewProviderOriginGroupExtension::updateOriginSize =>
OriginGroupExtension::getOrigin,

now, the latter that is the same that was throwing the exception and generating the error message above, does not throw anymore because Origin has been initialized.

When creating a new object, isNew==true; whereas when loading a file, isNew==false. Therefore, when loading a file setupObject is not executed. SetupObject, effectively initializes
the extension via: Body::setupObject => DocumentObject::setupObject => OriginGroupExtension::onExtendedSetupObject.

DocumentObject * Document::addObject(const char* sType, const char* pObjectName, bool isNew)
{
    [more code here]
    // Call the object-specific initialization
    if (!d->undoing && !d->rollback && isNew) {
        pcObject->setupObject ();
    }
    [more code here]

As DocumentObject code is generic for all objects (workbenches), by design it was chosen to initialize the object only if new. Therefore a object or an extension of a object being restored,
between the addition (addObject) and the restoring of the properties, must by design expect it not to be initialized.

The solution:

Making use of the Restore flag at document level (the one at object level is not sufficient), no exception regarding the null property is reported during document restoring.

Ticket:
https://freecadweb.org/tracker/view.php?id=2530

fixes #2530
2017-05-30 13:01:45 +02:00
Yorik van Havre
2a59e2ec67 Using PropertyFont in Arch, Draft 2017-05-27 22:55:56 -03:00
Yorik van Havre
de4d33cb84 Updated translations 2017-05-25 10:04:05 -03:00
Yorik van Havre
ec067c77d2 Display the number of selected elements in Selection View 2017-05-21 19:10:19 -03:00
wmayer
769bc97f63 workaround for broken tree indicators with Qt 5.6 under Windows 2017-05-21 10:02:26 +02:00
wmayer
0e605eccb3 workaround for broken tree indicators with Qt 5.6 under Windows 2017-05-20 21:21:30 +02:00
wmayer
982d73d93b extend error text set in Python console by additional information if present 2017-05-17 19:59:17 +02:00
wmayer
75652c247e in Python console check if exception is dict and set more readable text 2017-05-17 19:37:34 +02:00
wmayer
31710838d4 issue #0003025: Unhandled unknown exception caught in GUIApplication::notify when opening file 2017-05-16 10:37:34 +02:00
wmayer
61ad4c5e8d make creation of sub-elements in selection view more flexible 2017-05-10 15:01:36 +02:00
Yorik van Havre
97e93f01ed Added a 'show' option to the Selection View's context menu 2017-05-09 19:55:40 -03:00
DeepSOIC
775563baae Gui: expose ViewerPy.redraw() method 2017-05-08 11:44:41 -03:00
Yorik van Havre
1fb606f65d py3: Gui: files P-Z ported to python3 2017-05-06 20:11:31 +02:00
looooo
b5f83cdfef py3: resolve dangling-pointer issues 2017-05-06 17:23:27 +02:00
Yorik van Havre
7e39fed862 py3: Gui: files A-P ported to python3 2017-05-06 17:23:27 +02:00
DeepSOIC
7cf1cfb63e Gui: GestureNav: disable rotation when over a dragger 2017-05-06 12:48:26 +03:00
DeepSOIC
e1c68e59a6 Gui: GestureNav: fix constant hand cursor 2017-05-06 02:15:45 +03:00
triplus
4bf27344c8 Boot phase reference point 2017-05-04 20:03:34 +02:00
wmayer
ffa10bbf0c Qt5: workaround for undocking of mdi view
fix minor issues reported by clang static analyzer
2017-05-03 22:01:46 +02:00
DeepSOIC
624a3c4146 Gui: PickRadius support for View3DPy.getObjectInfo()
requested by Chris_G in forum thread "ActiveView.getObjectInfo ignores
pickRadius ?"
https://forum.freecadweb.org/viewtopic.php?f=22&t=22196
2017-05-03 16:51:36 +03:00
wmayer
df1da3f8d8 Qt5 port: workaround to keep multi-sampling when undocking mdi window 2017-05-01 18:53:58 +02:00
wmayer
5232aa745f if set display node name in scene inspector panel 2017-05-01 17:45:42 +02:00
wmayer
c831d66589 add SwitchBoard node class 2017-05-01 17:42:03 +02:00
wmayer
beff8eb3ca remove undesired virtual keyword from ViewProviderPythonFeatureImp 2017-04-28 21:15:53 +02:00
Yorik van Havre
77f652ea2f Gui: implemented isShow() for python viewproviders 2017-04-28 15:03:47 -03:00
wmayer
fb7094bf31 use specialized exception classes 2017-04-28 18:49:11 +02:00
wmayer
95ef6b15d3 fix crash when setting invalid selection filter, improve doc strings 2017-04-27 18:55:09 +02:00
asiersarasua
289f901c29 Fix typos 2017-04-23 18:48:21 -03:00
wmayer
0766340ebb fix clang warning: -Wunused-private-field 2017-04-22 15:55:18 +02:00
wmayer
6f230bfa58 fix build failure 2017-04-22 15:23:21 +02:00
wmayer
2e6345dbba Extend task panel for filling function 2017-04-22 14:46:26 +02:00
wmayer
e05f9dfa26 add lineedit class with clear button 2017-04-22 11:11:13 +02:00
asiersarasua
4564e4f4a4 Fix typos 2017-04-20 09:49:19 +02:00
Yorik van Havre
33cd945195 Added AlephObjects to credits 2017-04-17 23:25:14 -03:00
Yorik van Havre
7e487f0fee Small improvements to the PropertyLink editor
* The "Edit" link is now a button, same as the Placement editor
* Added a "None" entry on top of the Link dialog
2017-04-17 23:00:14 -03:00
wmayer
ba9ffed16b fix scan coverity issues 2017-04-11 15:06:37 +02:00
wmayer
c526c18b94 fix scan coverity issues: uncaught exception 2017-04-11 14:03:08 +02:00
Zheng, Lei
7a7fc95980 TreeView: fix children order when cyclic ref is found 2017-04-10 10:17:59 +02:00
wmayer
e4cba8e80f add new signal to Document class for convinience and add method to DocumentObserver 2017-04-07 15:14:45 +02:00
Alexander Gryson
16ef532113 Spin icon a little after forum feedback 2017-04-05 16:09:03 -03:00
Zheng, Lei
8f2aaa0934 TreeView: fix tree view performance
It seems on some system calling QTreeWidgetItem::takeChildren and then
addChild back is expensive. This fix avoids that but still keeps track
of item order in claimed children
2017-04-05 19:41:16 +02:00
triplus
0885044d89 Navigation indicator support 2017-04-04 12:38:17 +02:00
Zheng, Lei
087614afa0 TreeView: fixed disappearing item
The problem occurs when a child object is no longer claimed by its
former parent. The child tree item is not added back to Document root
even if it is the only instance left, which resulting the child object
disappearing entirely from the tree view.
2017-04-02 12:24:54 +08:00
wmayer
15dac7a32c extend API of TimerFunction class 2017-04-01 16:39:44 +02:00
wmayer
bd52c9c2f1 add missing header 2017-04-01 16:11:25 +02:00
Zheng, Lei
2707c43e52 Gui: allow bounding box style to be customized 2017-04-01 11:09:03 -03:00
Alexander Gryson
2395d06892 Update "as-is" icon based on forum feedback 2017-04-01 11:01:08 -03:00
Alexander Gryson
6dc82fe2d4 Align core icons to guidelines 2017-04-01 11:01:08 -03:00