View Issue Details

IDProjectCategoryView StatusLast Update
0003129Slicer4Module Transformspublic2017-06-07 23:27
Reporterlassoan Assigned Tojcfr  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.3.1Fixed in VersionSlicer 4.3.1 
Summary0003129: Slicer crashes if Alt+Tab is pressed when transforms module is active
Description

If the Transforms module is active when the user switches to another application using Alt+Tab then Slicer crashes.

How to reproduce:

  • Start Slicer
  • Open the Transforms module
  • Switch to another application using Alt+Tab
    => Slicer crashes

It happens only with the Transforms module (not with Welcome, Annotations, Data, Models, Volumes, etc.).

It is reproducible on Windows with Nightly releases: with the latest nightly (Slicer 4.2.0-2013-05-25 (Win64)) and also with older ones (such as (Slicer 4.2.0-2013-03-23 (Win64)). It is not reproducible with Slicer 4.2.2-1 (Win64).

Interestingly, the crash does not occur with this scenario:

  • Start Slicer
  • Switch to another application using Alt+Tab and switch back to Slicer using Alt+Tab
  • Open the Transforms module
  • Switch to another application using Alt+Tab
    => Slicer does NOT crashes

It seems that the crash is due to stack overflow when handling a focus change event.

TagsNo tags attached.

Activities

jcfr

jcfr

2013-05-27 13:13

administrator   ~0008674

Does the crash occur if building against Qt 4.8.4 ?
See http://download.qt-project.org/official_releases/qt/4.8/4.8.4/qt-win-opensource-4.8.4-vs2008.exe

lassoan

lassoan

2013-05-27 13:14

developer   ~0008675

It is reproducible using the official nightly build packages on Windows.

jcfr

jcfr

2013-05-27 13:20

administrator   ~0008677

I acknowledge the fact it crashes when built against 4.7.4.

That said, did you manage to reproduce the crash when building against Qt 4.8.4 ?

lassoan

lassoan

2013-05-27 13:27

developer   ~0008678

I haven't tried with 4.8.4, but I can start a build now and test it tomorrow.

jcfr

jcfr

2013-05-27 13:28

administrator   ~0008679

Would be great. Thks

lassoan

lassoan

2013-05-27 13:32

developer   ~0008680

Note that there is no crash with any other modules, so there is something wrong with the Transforms module GUI or one of its custom widgets. It would be better to investigate and understand the problem on 4.7.4, as it may be possible that upgrading to 4.8.4 will not solve the problem just make it harder to reproduce.

lassoan

lassoan

2013-05-27 17:28

developer   ~0008681

I confirm that the crash happens exactly the same way with Qt-4.8.4 (tested on windows, latest trunk, 32-bit, release mode).

chrysteljuan

chrysteljuan

2013-08-06 04:24

developer   ~0009387

This crash happens exactly the same way with Qt-4.8.5 (on windows 64-bit, release mode)

lassoan

lassoan

2013-08-17 13:38

developer   ~0009495

The crash happens the same way with the Reformat module as well (Win7, 2013-08-15 release)

lassoan

lassoan

2013-08-17 13:53

developer   ~0009496

The crash is cause by a stack overflow (First-chance exception at 0x65079e5f (QtGuid4.dll) in SlicerApp-real.exe: 0xC00000FD: Stack overflow.)

13 lines are repeated many times in the stack trace:

CTKWidgets.dll!ctkProxyStyle::ensureBaseStyle()  Line 114   C++
CTKWidgets.dll!ctkProxyStyle::styleHint(QStyle::StyleHint hint=SH_MenuBar_AltKeyNavigation, const QStyleOption * option=0x0000000000000000, const QWidget * widget=0x000000000902efc0, QStyleHintReturn * returnData=0x0000000000000000)  Line 214  C++
qSlicerBaseQTGUI.dll!qSlicerStyle::styleHint(QStyle::StyleHint hint=SH_MenuBar_AltKeyNavigation, const QStyleOption * opt=0x0000000000000000, const QWidget * widget=0x000000000902efc0, QStyleHintReturn * returnData=0x0000000000000000)  Line 285 + 0x32 bytes   C++
QtGuid4.dll!QMenuBar::eventFilter(QObject * object=0x0000000014206930, QEvent * event=0x0000000000221f38)  Line 1589 + 0x3e bytes   C++
QtCored4.dll!QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject * receiver=0x0000000014206930, QEvent * event=0x0000000000221f38)  Line 883 + 0x1a bytes   C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver=0x0000000014206930, QEvent * e=0x0000000000221f38)  Line 4456 + 0x15 bytes    C++
QtGuid4.dll!QApplication::notify(QObject * receiver=0x0000000014206930, QEvent * e=0x0000000000221f38)  Line 3881 + 0x1d bytes  C++
QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver=0x0000000014206930, QEvent * event=0x0000000000221f38)  Line 787 + 0x26 bytes  C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver=0x0000000014206930, QEvent * event=0x0000000000221f38)  Line 215 + 0x50 bytes   C++
QtCored4.dll!QObjectPrivate::setParent_helper(QObject * o=0x0000000000000000)  Line 1981 + 0x16 bytes   C++
QtCored4.dll!QObject::setParent(QObject * parent=0x0000000000000000)  Line 1943 C++
CTKWidgets.dll!ctkProxyStylePrivate::setBaseStyle(QProxyStyle * proxy=0x0000000014206930, QStyle * style=0x000000000516c290)  Line 73   C++
CTKWidgets.dll!ctkProxyStylePrivate::setProxyStyle(QProxyStyle * proxy=0x0000000014206930, QStyle * style=0x000000000516c290)  Line 57  C++

CTKWidgets.dll!ctkProxyStyle::ensureBaseStyle()  Line 114   C++
CTKWidgets.dll!ctkProxyStyle::styleHint(QStyle::StyleHint hint=SH_MenuBar_AltKeyNavigation, const QStyleOption * option=0x0000000000000000, const QWidget * widget=0x000000000902efc0, QStyleHintReturn * returnData=0x0000000000000000)  Line 214  C++
qSlicerBaseQTGUI.dll!qSlicerStyle::styleHint(QStyle::StyleHint hint=SH_MenuBar_AltKeyNavigation, const QStyleOption * opt=0x0000000000000000, const QWidget * widget=0x000000000902efc0, QStyleHintReturn * returnData=0x0000000000000000)  Line 285 + 0x32 bytes   C++
QtGuid4.dll!QMenuBar::eventFilter(QObject * object=0x0000000014206930, QEvent * event=0x0000000000222b98)  Line 1589 + 0x3e bytes   C++
QtCored4.dll!QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject * receiver=0x0000000014206930, QEvent * event=0x0000000000222b98)  Line 883 + 0x1a bytes   C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver=0x0000000014206930, QEvent * e=0x0000000000222b98)  Line 4456 + 0x15 bytes    C++
QtGuid4.dll!QApplication::notify(QObject * receiver=0x0000000014206930, QEvent * e=0x0000000000222b98)  Line 3881 + 0x1d bytes  C++
QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver=0x0000000014206930, QEvent * event=0x0000000000222b98)  Line 787 + 0x26 bytes  C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver=0x0000000014206930, QEvent * event=0x0000000000222b98)  Line 215 + 0x50 bytes   C++
QtCored4.dll!QObjectPrivate::setParent_helper(QObject * o=0x0000000000000000)  Line 1981 + 0x16 bytes   C++
QtCored4.dll!QObject::setParent(QObject * parent=0x0000000000000000)  Line 1943 C++
CTKWidgets.dll!ctkProxyStylePrivate::setBaseStyle(QProxyStyle * proxy=0x0000000014206930, QStyle * style=0x000000000516c290)  Line 73   C++
CTKWidgets.dll!ctkProxyStylePrivate::setProxyStyle(QProxyStyle * proxy=0x0000000014206930, QStyle * style=0x000000000516c290)  Line 57  C++

CTKWidgets.dll!ctkProxyStyle::ensureBaseStyle()  Line 114   C++
CTKWidgets.dll!ctkProxyStyle::styleHint(QStyle::StyleHint hint=SH_MenuBar_AltKeyNavigation, const QStyleOption * option=0x0000000000000000, const QWidget * widget=0x000000000902efc0, QStyleHintReturn * returnData=0x0000000000000000)  Line 214  C++
qSlicerBaseQTGUI.dll!qSlicerStyle::styleHint(QStyle::StyleHint hint=SH_MenuBar_AltKeyNavigation, const QStyleOption * opt=0x0000000000000000, const QWidget * widget=0x000000000902efc0, QStyleHintReturn * returnData=0x0000000000000000)  Line 285 + 0x32 bytes   C++
QtGuid4.dll!QMenuBar::eventFilter(QObject * object=0x0000000014206930, QEvent * event=0x00000000002237f8)  Line 1589 + 0x3e bytes   C++
QtCored4.dll!QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject * receiver=0x0000000014206930, QEvent * event=0x00000000002237f8)  Line 883 + 0x1a bytes   C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver=0x0000000014206930, QEvent * e=0x00000000002237f8)  Line 4456 + 0x15 bytes    C++
QtGuid4.dll!QApplication::notify(QObject * receiver=0x0000000014206930, QEvent * e=0x00000000002237f8)  Line 3881 + 0x1d bytes  C++
QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver=0x0000000014206930, QEvent * event=0x00000000002237f8)  Line 787 + 0x26 bytes  C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver=0x0000000014206930, QEvent * event=0x00000000002237f8)  Line 215 + 0x50 bytes   C++
QtCored4.dll!QObjectPrivate::setParent_helper(QObject * o=0x0000000000000000)  Line 1981 + 0x16 bytes   C++
QtCored4.dll!QObject::setParent(QObject * parent=0x0000000000000000)  Line 1943 C++
CTKWidgets.dll!ctkProxyStylePrivate::setBaseStyle(QProxyStyle * proxy=0x0000000014206930, QStyle * style=0x000000000516c290)  Line 73   C++
CTKWidgets.dll!ctkProxyStylePrivate::setProxyStyle(QProxyStyle * proxy=0x0000000014206930, QStyle * style=0x000000000516c290)  Line 57  C++
CTKWidgets.dll!ctkProxyStyle::ensureBaseStyle()  Line 114   C++

...

It seems that there is an infinite loop while applying some QT style?

jcfr

jcfr

2013-09-03 07:38

administrator   ~0009831

@Chrystel: Can you reproduce this problem ?

chrysteljuan

chrysteljuan

2013-09-03 09:06

developer   ~0009835

I can reproduce this problem, Slicer crashes on Windows with the r22390 Slicer revision

jcfr

jcfr

2013-09-03 09:12

administrator   ~0009836

Since this is still an issue - Re-targeted for 4.3.1

(Thanks Chrystel)

lassoan

lassoan

2013-09-30 21:34

developer   ~0010110

As I wrote above, the crash is due to infinite loop in ctkProxyStyle::ensureBaseStyle(). There is a very simple fix for this: if ensureBaseStyle is requested on an object where it is already in progress then just ignore the request.

See below a patch that implements this simple reentrance check. I've tested it and prevents the crashes and there doesn't seem to be any side-effect.

diff --git "a/C:\Users\lasso\AppData\Local\Temp\TortoiseGit\ctk77F9.tmp\ctkProxyStyle-90000c3-left.cpp" "b/F:\S4D\CTK\Libs\Widgets\ctkProxyStyle.cpp"
index a159829..c27f239 100644
--- "a/C:\Users\lasso\AppData\Local\Temp\TortoiseGit\ctk77F9.tmp\ctkProxyStyle-90000c3-left.cpp"
+++ "b/F:\S4D\CTK\Libs\Widgets\ctkProxyStyle.cpp"
@@ -38,11 +38,13 @@ public:
private:
ctkProxyStylePrivate(ctkProxyStyle& object);
mutable QPointer <QStyle> baseStyle;

  • mutable bool ensureBaseStyleInProgress;
    };

    // ----------------------------------------------------------------------------
    ctkProxyStylePrivate::ctkProxyStylePrivate(ctkProxyStyle& object)
    : q_ptr(&object)

  • , ensureBaseStyleInProgress(false)
    {
    }

@@ -102,6 +104,12 @@ ctkProxyStyle::~ctkProxyStyle()
void ctkProxyStyle::ensureBaseStyle() const
{
Q_D(const ctkProxyStyle);

  • if (d->ensureBaseStyleInProgress)
  • {
  • // avoid infinite loop
  • return;
  • }
  • d->ensureBaseStyleInProgress = true;
    d->baseStyle = this->baseStyle();
    // Set the proxy to the entire hierarchy.
    QProxyStyle proxyStyle = const_cast<QProxyStyle>(qobject_cast<const QProxyStyle*>(
    @@ -115,6 +123,7 @@ void ctkProxyStyle::ensureBaseStyle() const
    baseStyle = proxy ? proxy->baseStyle() : 0;
    }
    d->setBaseStyle(proxyStyle, proxyBaseStyle);
  • d->ensureBaseStyleInProgress = false;
    }

    // ----------------------------------------------------------------------------

lassoan

lassoan

2013-10-01 08:49

developer   ~0010111

Sent pull request to CTK:
https://github.com/lassoan/CTK/commit/a8ebaefdaf2fdf9fc3208e57a7b3c9a82184fee8
https://github.com/commontk/CTK/issues/371

jcfr

jcfr

2013-10-01 11:32

administrator   ~0010115

Fixed in r22541
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&amp;revision=22541

jcfr

jcfr

2014-03-06 05:00

administrator   ~0010877

Closing resolved issues that have not been updated in more than 3 months

jcfr

jcfr

2017-06-07 23:27

administrator   ~0014577

Fix committed to 2145-support-for-installing-extension-from-file branch.

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file 73229447

2013-10-01 15:32:17

jcfr

Details Diff
BUG: Fix crash if Alt+Tab is pressed when transforms module is active.

$ git shortlog 90000c32..f64b68acd
Andras Lasso (1):
Prevent reentrant calling of ctkProxyStyle::ensureBaseStyle()

Jean-Christophe Fillion-Robin (1):
Merge pull request 0000372 from lassoan/371-ensure-base-style-infinite-recursion-crash

Fixes 0003129

From: Andras Lasso <lasso@cs.queensu.ca>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22541 3bd1e089-480b-0410-8dfb-8563597acbee
mod - SuperBuild/External_CTK.cmake Diff File

Issue History

Date Modified Username Field Change
2013-05-26 18:35 lassoan New Issue
2013-05-27 13:12 jcfr Assigned To => jcfr
2013-05-27 13:12 jcfr Status new => assigned
2013-05-27 13:12 jcfr Target Version => Slicer 4.3.0
2013-05-27 13:13 jcfr Note Added: 0008674
2013-05-27 13:13 jcfr Status assigned => feedback
2013-05-27 13:14 lassoan Note Added: 0008675
2013-05-27 13:20 jcfr Note Added: 0008677
2013-05-27 13:27 lassoan Note Added: 0008678
2013-05-27 13:28 jcfr Note Added: 0008679
2013-05-27 13:32 lassoan Note Added: 0008680
2013-05-27 17:28 lassoan Note Added: 0008681
2013-08-06 04:24 chrysteljuan Note Added: 0009387
2013-08-17 13:38 lassoan Note Added: 0009495
2013-08-17 13:53 lassoan Note Added: 0009496
2013-09-03 07:38 jcfr Status feedback => assigned
2013-09-03 07:38 jcfr Assigned To jcfr => chrysteljuan
2013-09-03 07:38 jcfr Note Added: 0009831
2013-09-03 09:06 chrysteljuan Note Added: 0009835
2013-09-03 09:11 jcfr Target Version Slicer 4.3.0 => Slicer 4.3.1
2013-09-03 09:12 jcfr Note Added: 0009836
2013-09-30 21:34 lassoan Note Added: 0010110
2013-10-01 08:49 lassoan Note Added: 0010111
2013-10-01 09:10 jcfr Assigned To chrysteljuan => jcfr
2013-10-01 11:32 jcfr Note Added: 0010115
2013-10-01 11:32 jcfr Status assigned => resolved
2013-10-01 11:32 jcfr Fixed in Version => Slicer 4.3.1
2013-10-01 11:32 jcfr Resolution open => fixed
2014-03-06 05:00 jcfr Note Added: 0010877
2014-03-06 05:01 jcfr Status resolved => closed
2017-06-07 23:27 jcfr Changeset attached => Slicer 2145-support-for-installing-extension-from-file 73229447
2017-06-07 23:27 jcfr Note Added: 0014577