View Issue Details

IDProjectCategoryView StatusLast Update
0001354PartDesignBugpublic2014-06-24 08:38
ReporterCarstenH Assigned Towmayer  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformIntel OSMAC OS XOS Version10.9.1
Summary0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries
DescriptionI tried to confirm a value for the size of a chamfer by using the Enter-Key on my keyboard. This causes FreeCAD to crash. The same is happening for the fillet function. If I use the OK-Button in the GUI everything is fine.

Version FreeCAD 0.14, Libs: 0.14R2408 (Git)

Any idea??
Steps To Reproduce1. Start FreeCAD
2. Open New Document (icon)
3. Change to "Part" workbench
4. Create a box solid (icon)
5. Start chamfer function (icon)
6. Select single (or multiple) edge
7. Mouse-click in Combo-View to activate it
8. Hit Enter-Key to create chamfer
9. Chamfer is applied and displayed
10. No further inputs possible and FreeCAD crashes some seconds later :-(
Additional InformationConsole output:

/Applications/FreeCAD.app/Contents/MacOS/FreeCAD -l
FreeCAD 0.14, Libs: 0.14R2408 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2011
  ##### #### ### ####
  # # # # # #
  # ## #### #### # # # # #
  #### # # # # # # # ##### # #
  # # #### #### # # # # #
  # # # # # # # # # ## ## ##
  # # #### #### ### # # #### ## ## ##

matplotlib not found, Plot module will be disabled
Teigha File Converter not found, DWG support will be disabled.
pycollada not found, collada support will be disabled.
2014-01-12 22:47:54.903 FreeCAD[14526:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-01-12 22:47:54.903 FreeCAD[14526:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
2014-01-12 22:47:54.908 FreeCAD[14526:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-01-12 22:47:54.909 FreeCAD[14526:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-01-12 22:47:54.910 FreeCAD[14526:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-01-12 22:47:54.911 FreeCAD[14526:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-01-12 22:47:54.912 FreeCAD[14526:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-01-12 22:48:43.413 FreeCAD[14526:507] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
*** Abort *** an exception was raised, but no catch was found.
    ... The exception is:SIGSEGV 'segmentation violation' detected. Address 21
Terminated: 15
TagsNo tags attached.
FreeCAD Information

Activities

peterl94

2014-01-23 01:33

developer   ~0004114

I can confirm this on my system as well with both of my builds (2048, and 3052). It seams to only happen when you hit enter when the mouse is over the header of the task options -- it doesn't matter what task. Also, it must be a Mac only bug, because I can't reproduce it on Windows or Ubuntu.

I'll do a debug build and see what I can find.

peterl94

2014-01-24 02:55

developer  

bt.txt (986 bytes)   
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000021
0x0000000106701bdd in QMetaObject::changeGuard ()
(gdb) bt
#0  0x0000000106701bdd in QMetaObject::changeGuard ()
#1  0x00000001050fdfa5 in qt_mac_updateCursorWithWidgetUnderMouse ()
#2  0x0000000105126968 in qt_mac_handleMouseEvent ()
#3  0x000000010511ba94 in -[QCocoaWindow sendEvent:] ()
#4  0x00007fff82b8bafa in -[NSApplication sendEvent:] ()
#5  0x0000000105120b34 in -[QNSApplication sendEvent:] ()
#6  0x00007fff82b226de in -[NSApplication run] ()
#7  0x000000010512b9b0 in QEventDispatcherMac::processEvents ()
#8  0x00000001066eb034 in QEventLoop::processEvents ()
#9  0x00000001066eb3e4 in QEventLoop::exec ()
#10 0x00000001066ed7fc in QCoreApplication::exec ()
#11 0x000000010003f6e9 in Gui::Application::runApplication () at /Users/family/FreeCAD/FreeCAD-src/src/Gui/Application.cpp:1785
#12 0x000000010000a61b in main (argc=1, argv=0x7fff5fbff978)
bt.txt (986 bytes)   

peterl94

2014-01-24 02:56

developer  

accept_stack.txt (2,815 bytes)   
Breakpoint 1, PartGui::DlgFilletEdges::accept (this=0x12588cfc0) at /Users/family/FreeCAD/FreeCAD-src/src/Mod/Part/Gui/DlgFilletEdges.cpp:810
810	    QByteArray to = name.toAscii();
(gdb) where
#0  PartGui::DlgFilletEdges::accept (this=0x12588cfc0) at /Users/family/FreeCAD/FreeCAD-src/src/Mod/Part/Gui/DlgFilletEdges.cpp:810
#1  0x00000001217c270d in PartGui::TaskFilletEdges::accept (this=0x12588c060) at /Users/family/FreeCAD/FreeCAD-src/src/Mod/Part/Gui/DlgFilletEdges.cpp:873
#2  0x00000001002a9128 in Gui::TaskView::TaskView::accept (this=0x106deb160) at /Users/family/FreeCAD/FreeCAD-src/src/Gui/TaskView/TaskView.cpp:484
#3  0x00000001002a91c5 in Gui::TaskView::TaskView::qt_static_metacall (_o=0x106deb160, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff5fbfcd00) at moc_TaskView.cpp:242
#4  0x0000000106703a8e in QMetaObject::activate ()
#5  0x0000000106703a8e in QMetaObject::activate ()
#6  0x00000001057c27b1 in QAbstractButton::clicked ()
#7  0x00000001054ee5c0 in QAbstractButtonPrivate::emitClicked ()
#8  0x00000001054ee94f in QAbstractButton::click ()
#9  0x00000001002a96f4 in Gui::TaskView::TaskView::keyPressEvent (this=0x106deb160, ke=0x7fff5fbfd9c0) at /Users/family/FreeCAD/FreeCAD-src/src/Gui/TaskView/TaskView.cpp:278
#10 0x00000001051cb635 in QWidget::event ()
#11 0x0000000105535d8c in QFrame::event ()
#12 0x00000001055bd3cb in QAbstractScrollArea::event ()
#13 0x00000001055c1195 in QScrollArea::event ()
#14 0x000000010517274d in QApplicationPrivate::notify_helper ()
#15 0x000000010517931b in QApplication::notify ()
#16 0x000000010004d874 in Gui::GUIApplication::notify (this=0x7fff5fbfe920, receiver=0x106deb160, event=0x7fff5fbfd9c0) at /Users/family/FreeCAD/FreeCAD-src/src/Gui/Application.cpp:1515
#17 0x00000001066ec12c in QCoreApplication::notifyInternal ()
#18 0x000000010517182c in qt_sendSpontaneousEvent ()
#19 0x00000001051e95f8 in QKeyMapper::sendKeyEvent ()
#20 0x00000001051ea3a3 in QKeyMapperPrivate::translateKeyEvent ()
#21 0x000000010512609f in qt_dispatchKeyEvent ()
#22 0x0000000105116dcf in -[QCocoaView keyDown:] ()
#23 0x00007fff82c570c7 in -[NSWindow sendEvent:] ()
#24 0x000000010511ba57 in -[QCocoaWindow sendEvent:] ()
#25 0x00007fff82b8bafa in -[NSApplication sendEvent:] ()
#26 0x0000000105120b34 in -[QNSApplication sendEvent:] ()
#27 0x00007fff82b226de in -[NSApplication run] ()
#28 0x000000010512b9b0 in QEventDispatcherMac::processEvents ()
#29 0x00000001066eb034 in QEventLoop::processEvents ()
#30 0x00000001066eb3e4 in QEventLoop::exec ()
#31 0x00000001066ed7fc in QCoreApplication::exec ()
#32 0x000000010003f6e9 in Gui::Application::runApplication () at /Users/family/FreeCAD/FreeCAD-src/src/Gui/Application.cpp:1785
#33 0x000000010000a61b in main (argc=1, argv=0x7fff5fbff978) at /Users/family/FreeCAD/FreeCAD-src/src/Main/MainGui.cpp:309
accept_stack.txt (2,815 bytes)   

peterl94

2014-01-24 03:10

developer   ~0004121

Last edited: 2014-01-24 03:13

View 2 revisions

Hmm...it seams something is triggering an obscure qt mac bug. This is the error I get:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000021
0x0000000106701bdd in QMetaObject::changeGuard ()

I've attached the back trace and the stack after reaching a break point in PartGui::DlgFilletEdges::accept. Stepping after the break point, it gets all of the way back down to [NSApplication run] (), and then it crashes.

The weird thing is that it only happens when the mouse is over the TaskDialog and you hit the enter key. If the mouse is over anything else, it works fine. Also, I can now only make it crash with Part task dialogs. (I originally was able to make it crash with some PartDesign tasks as well). I think the problem has something to do with the task dialog being deleted, but I'm not sure.

wmayer

2014-06-22 09:13

administrator  

0001354.patch (1,453 bytes)   
diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp
index aa52c86..fbe429d 100644
--- a/src/Gui/TaskView/TaskView.cpp
+++ b/src/Gui/TaskView/TaskView.cpp
@@ -25,6 +25,7 @@
 
 #ifndef _PreComp_
 # include <boost/bind.hpp>
+# include <QCursor>
 #endif
 
 #include "TaskView.h"
@@ -274,8 +275,12 @@ void TaskView::keyPressEvent(QKeyEvent* ke)
             for (int i=0; i<list.size(); ++i) {
                 QPushButton *pb = list.at(i);
                 if (pb->isDefault() && pb->isVisible()) {
-                    if (pb->isEnabled())
+                    if (pb->isEnabled()) {
+#if defined(FC_OS_MACOSX)
+                        QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
+#endif
                         pb->click();
+                    }
                     return;
                 }
             }
@@ -287,8 +292,12 @@ void TaskView::keyPressEvent(QKeyEvent* ke)
             for (int i=0; i<list.size(); ++i) {
                 QAbstractButton *pb = list.at(i);
                 if (box->buttonRole(pb) == QDialogButtonBox::RejectRole) {
-                    if (pb->isEnabled())
+                    if (pb->isEnabled()) {
+#if defined(FC_OS_MACOSX)
+                        QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
+#endif
                         pb->click();
+                    }
                     return;
                 }
             }
0001354.patch (1,453 bytes)   

wmayer

2014-06-22 09:15

administrator   ~0004762

Attached is a patch that possible solves the issue. The trick is to move the cursor to the position of the OK button (when pressing Enter) or Cancel button (when pressing ESC).

Can someone with a Mac check this workaround?

peterl94

2014-06-22 19:58

developer   ~0004764

Yeah that solves the problem. It's a little strange to have the mouse jump, but it's better than crashing.

wmayer

2014-06-23 09:05

administrator   ~0004765

It can further be checked if restoring the old cursor position still fixes the issue, i.e:

QPoint pos = QCursor::pos();
QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
pb->click();
QCursor::setPos(pos);

peterl94

2014-06-24 05:41

developer   ~0004768

Perfect. That works.

Related Changesets

FreeCAD: master ef08a61a

2014-06-24 10:18:58

wmayer

Details Diff
+ fixes 0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries Affected Issues
0001354
mod - src/Gui/TaskView/TaskView.cpp Diff File

Issue History

Date Modified Username Field Change
2014-01-12 22:06 CarstenH New Issue
2014-01-23 01:33 peterl94 Note Added: 0004114
2014-01-24 02:55 peterl94 File Added: bt.txt
2014-01-24 02:56 peterl94 File Added: accept_stack.txt
2014-01-24 03:10 peterl94 Note Added: 0004121
2014-01-24 03:13 peterl94 Note Edited: 0004121 View Revisions
2014-06-22 09:13 wmayer File Added: 0001354.patch
2014-06-22 09:15 wmayer Note Added: 0004762
2014-06-22 19:58 peterl94 Note Added: 0004764
2014-06-23 09:05 wmayer Note Added: 0004765
2014-06-24 05:41 peterl94 Note Added: 0004768
2014-06-24 08:38 wmayer Changeset attached => FreeCAD Master master ef08a61a
2014-06-24 08:38 wmayer Assigned To => wmayer
2014-06-24 08:38 wmayer Status new => closed
2014-06-24 08:38 wmayer Resolution open => fixed