# Segmentation fault with any applied Qt stylesheet when switch off from Transform Module

**URL:** <https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584>\
**Category:** Development\
**Created:** [January 23, 2022, 7:34pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584 "2022-01-23T19:34:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [January 23, 2022, 7:34pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/1 "2022-01-23T19:34:46Z")

</div>

Hi,

On Ubuntu 20.04 if I try to apply Qt stylesheet (for example using [SandBox](https://github.com/PerkLab/SlicerSandbox) style tester with these two default lines) and switch after that I switch to the Transform module and then switch to any other module I get segmentation fault. This makes Qt stylesheets unusable.

Does this happen only on Ubuntu?

I haven’t figured out why this happens only with Transform module but it seems that something related to applying style during `qSlicerModulePanel::removeModule`:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/d/bda25ea7297f81e3973887e07c2ab1175c09308c.jpeg)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [February 3, 2022, 6:57pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/2 "2022-02-03T18:57:18Z")

</div>

Thanks for the report 🙏

We should definitely understand the issue and address the problem.

To help move forward with this, could you:

- share a small standalone example allowing to reproduce the problem. It could be as simple as a list of steps to follow, and few lines that need to be copied into the python interactor
- provide some context for reproducing:
  - can it be reproduced using the preview package available from [https://download.slicer.org](https://download.slicer.org)
  - is the issue specific to a build of Slicer (if yes, which version of Qt)

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [February 3, 2022, 7:23pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/3 "2022-02-03T19:23:29Z")

</div>

Thank you for reply,

Steps to reproduce:

1. from extension manager install `Sandbox` extension;
2. restart Slicer;
3. after the restart go to the `Modules->Developer Tools->StyleTester` and click on `Apply to Slicer` radiobutton and then click `Apply Style` pushbutton;
4. go to the `Modules->Transforms` (should be fine);
5. go to any other module (for example `Modules->Data`) or click `Previous modules` tool button (here I get segfault)

This can be reproduced on Ubuntu 20.04 with Slicer downloaded from official web-site v4.13.0 built 2022-02-03 or with Slicer manually built with Qt 5.15.2 with GCC 9.3

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [March 27, 2022, 3:44pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/4 "2022-03-27T15:44:40Z")

</div>

I just tested that on Windows and it seems that there is no such problem.  
But on Ubuntu I get segfault even with the newest Slicer version 2022-03-26

---

<div class="post-metadata">

**Author:** ![ebrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebrahim/32/13403_2.png) [@ebrahim](https://discourse.slicer.org/u/ebrahim)\
**Post date:** [March 27, 2022, 8:27pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/5 "2022-03-27T20:27:22Z")

</div>

This might be the same thing I ran into with my slicer custom app here: [crash when switching out of transforms module · Issue #15 · KitwareMedical/lungair-desktop-application · GitHub](https://github.com/KitwareMedical/lungair-desktop-application/issues/15)

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [March 27, 2022, 8:39pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/6 "2022-03-27T20:39:07Z")

</div>

Yes I think we encountered the same crash.  
But it is not only about SlicerCAT but I can see this crash in Slicer app.  
Did you ran into this on Linux?

---

<div class="post-metadata">

**Author:** ![ebrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebrahim/32/13403_2.png) [@ebrahim](https://discourse.slicer.org/u/ebrahim)\
**Post date:** [March 28, 2022, 1:55am UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/7 "2022-03-28T01:55:12Z")

</div>

Yes, this was also on Ubuntu 20.04

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [April 18, 2023, 6:34pm UTC](https://discourse.slicer.org/t/segmentation-fault-with-any-applied-qt-stylesheet-when-switch-off-from-transform-module/21584/8 "2023-04-18T18:34:49Z")

</div>

New investigations of that problem are [described here](https://github.com/KitwareMedical/lungair-desktop-application/issues/15#issuecomment-1513018055).

Appreciate if somebody take a look.
