View Issue Details

IDProjectCategoryView StatusLast Update
0000665FreeCADBugpublic2012-10-01 10:45
Reporterjeanphilippe Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version0.12 
Fixed in Version0.13 
Summary0000665: Follow up 0000640: This file crashes FreeCAD UI latest Git
DescriptionHi,
While looking at this crash 640, I seem to have investigated an other issue.
The information I added there where related to a crash in the UI.

I pulled git, and seen the patch for 640 beeing executed (breakpoint).
However, I still get the same crash in QT.

"
Log: Sel : Rmv Selection "pole_piece_2_baffles___linked.Pocket002.(null)"
Log: QWidget::repaint: Recursive repaint detected
"
-> crash


process:
"
>cd testDir
>tar -xvf test.tar
>gdb FreeCad
(gdb) > cd testDir
(gdb) > run -l pole+piece+2+baffles+-+linked.FCStd
-> wait until open
-> scroll Label & Attributes dock window all the way down.
-> Place the cursor on the last elt ("Pocket Groove0,1,2").
-> left click to select and do not move the cursor (I have a laptop with touchpad)
-> press the 'suppr' key on the keyboard (might be 'Del' on english keyboard)

Program received signal SIGSEGV, Segmentation fault.
QRasterPaintEngine::brushOriginChanged (this=0x8324c18) at painting/qpaintengine_raster.cpp:809
(gdb)
"

Thanks,
JP.
Additional InformationNote:
I'm new using freecad, so I'm not completely sure I have the exact correct configuration. I ran the freecad test and they pass. So I assume it's ok.

I could not add a note on the previous bug, and it seems to be a different issue so I open this new bug.

./gui/kernel/qwidget.cpp:5534
qWarning("QWidget::repaint: Recursive repaint detected");
TagsNo tags attached.
FreeCAD Information

Activities

2012-04-07 13:40

 

test.tar (Attachment missing)

2012-04-07 13:42

 

crashLogAndStack.tar (Attachment missing)

jeanphilippe

2012-04-07 15:45

reporter   ~0001901

I am far from being a QT expert, so the proposed solution might not be correct but it stop the crash so I post it.

Proof of concept:

gibus@gibusPc:~/Dvp/FreeCad/freecad$ git diff
diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp
index 9d19c5b..860ed6d 100644
--- a/src/Gui/Tree.cpp
+++ b/src/Gui/Tree.cpp
@@ -1167,7 +1167,11 @@ void DocumentObjectItem::displayStatusInfo()
     QString info = QString::fromAscii(Obj->getStatusString());
     if ( Obj->mustExecute() == 1 )
         info += QString::fromAscii(" (but must be executed)");
- getMainWindow()->statusBar()->showMessage( info );
+ QMetaObject::invokeMethod(getMainWindow()->statusBar(), "showMessage",
+ Qt::/*Blocking*/QueuedConnection,
+ QGenericReturnArgument(),
+ Q_ARG(QString,info));
+ //getMainWindow()->statusBar()->showMessage( info );
    
 }


Note: this is a proof of concept, copied from ProgressBar.cpp.
I think a proper fix would be done in 2 times (as the problem might appear in different circumstance)

1 - refactor all calls to getMainWindow()->statusBar()->showMessage to be getMainWindow()->showMessage (slight behavior change(use fontMetric::elidedText before callingQStqtusBar::showMessage. would it be correct)

2 - change MainWindow::showMessage from calling 'this->statusBar()->showMessage(msg, timeout);'
to use QMetaObject::invokeMethod with QueuedConnection

If this is not too urgent, I would be happy to code that for you in a branch(jeanphilippe/dev) if the solution seems right to people more knowledgeable with QT.

Should there be a regression test associated with it?
Thanks,
JP.

jeanphilippe

2012-04-08 08:52

reporter   ~0001907

Hi,
I set up a github. (safer and cleaner, don't need write access to sourceforge): github.com/jeanphilippeD/FreeCAD

The proposed fix are in the last 2 commits:
refactor 7639bb15a1c4dc19c12c78711b5253519ab2e3ad
Fix 473ba10c5e11f19e3dff9c1f47ad42a36045ab09

Note:
1 - the name of MainWindow::showMessage could be changed to 'queueStatusMsg' or something better to reflect the new usage(I could do that in a further commit)

2 - should MainWindow::statusBar() be made private or protected to avoid bad use. (the few remaining use of it would have to be redirected through MainWindow).

3 - found something strange, connect 1 slot and disconnect an other:
MainWindow::addWindow
connect(view, SIGNAL(message(const QString&, int)),
            statusBar(), SLOT(showMessage(const QString&, int)));
MainWindow::removeWindow
disconnect(view, SIGNAL(message(const QString&, int)),
               statusBar(), SLOT(message(const QString&, int )));
Also, are they needed?

Hope it is helpful.
Thanks,
JP.

jeanphilippe

2012-04-08 16:07

reporter   ~0001910

Note on reproductibility:
The main window need to be small enough for a vertical scroll bar on the tree to be there. resize main window if needed to reproduce crash.

wmayer

2012-04-10 14:57

administrator   ~0001915

What Qt version do you use? To me it seems it's rather a Qt bug than a FreeCAD bug because the way how we show the information in displayStatusInfo() is OK IMO.
And with Qt 4.5.3 and 4.8.4 I was not able to reproduce any crashes.

jeanphilippe

2012-04-10 15:33

reporter   ~0001920

Thanks for the answer.

$ qmake --version
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/i386-linux-gnu

I'll upgrade to 4.8.4 when I come back from holiday next monday.
Thanks,
JP.

wmayer

2012-04-12 12:03

administrator   ~0001932

Oops, it's not Qt 4.8.4 but also 4.8.1 and still no luck to reproduce this crash.

2012-04-17 08:00

 

screenShots.tar (Attachment missing)

jeanphilippe

2012-04-17 08:13

reporter   ~0001953

Hi,

I'm on ubuntu 12.04 (last beta), all updated today.
used the software center to install freecad 0.12.5284-dfsg-5ubuntu1

The crash still occurs.

I uploaded screenShots.tar which contain screenShots of the 5 steps I took and the logFile.
2 things seem key:
 - the window need to be small enough so that you need to scroll.
 - the cursor need to be on the selected item when pressing 'suppr' (you can move the cursor away and place it back (as I did when taking screenshots))

Note:
The crash do not occur on windows.

The end of the log:

Log: ESC[31mvoid DBusMenuExporterPrivate::addAction(QAction*, int)ESC[0m: Already tracking action "Toggle visibility" under id 218
Log: ESC[31mvoid DBusMenuExporterPrivate::addAction(QAction*, int)ESC[0m: Already tracking action "Chamfer..." under id 330
Log: Active view is pole+piece+2+baffles+-+linked : 1
  • (at 0x86bbcb0)
  • Log: Active view is pole+piece+2+baffles+-+linked : 1
  • (at 0x86bbcb0)
  • Log: Sel : Rmv Selection "pole_piece_2_baffles___linked.Pocket002.(null)"
    Log: QWidget::repaint: Recursive repaint detected
    Err: Illegal storage access...Err:

    Thanks,
    JP.

    wmayer

    2012-10-01 10:45

    administrator   ~0002437

    git show 58da2ebbcc94d0bb203b0ce70069abd77c2b8bab

    Issue History

    Date Modified Username Field Change
    2012-04-07 13:40 jeanphilippe New Issue
    2012-04-07 13:40 jeanphilippe File Added: test.tar
    2012-04-07 13:42 jeanphilippe File Added: crashLogAndStack.tar
    2012-04-07 15:45 jeanphilippe Note Added: 0001901
    2012-04-08 08:52 jeanphilippe Note Added: 0001907
    2012-04-08 16:07 jeanphilippe Note Added: 0001910
    2012-04-10 14:57 wmayer Note Added: 0001915
    2012-04-10 15:33 jeanphilippe Note Added: 0001920
    2012-04-12 12:03 wmayer Note Added: 0001932
    2012-04-17 08:00 jeanphilippe File Added: screenShots.tar
    2012-04-17 08:13 jeanphilippe Note Added: 0001953
    2012-10-01 10:45 wmayer Note Added: 0002437
    2012-10-01 10:45 wmayer Status new => closed
    2012-10-01 10:45 wmayer Resolution open => fixed
    2012-10-01 10:45 wmayer Fixed in Version => 0.13