View Issue Details

IDProjectCategoryView StatusLast Update
0003991Slicer4Core: GUIpublic2017-06-10 08:51
ReporterpinterAssigned Tonicole 
Status closedResolutionfixed 
Product VersionSlicer 4.4.0 
Target VersionFixed in VersionSlicer 4.6.0 
Summary0003991: Node names in form "1: Something" confuse save dialog, lead to crash

Happens on Windows

  1. Load MRHead
  2. Rename it to "1: MRHead"
  3. Click Save button

It does not always crash (it does with one of my test data), but it is reproducible on Windows.

20150426_SaveDialogIssue.png shows the non-crash scenario,
20150426_SaveFileCrash.png shows where it crashes
The last Slicer call is line 534 in qSlicerSaveDataDialog.cxx:

Additional Information

Calling function nativeAbsoluteFilePath in QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) makes wrong substitutions in file name, for example it changes "3: RTSTRUCT.seg" to "3:\ RTSTRUCT.seg", which leads to crash in qfilesystemengine_win.cpp, line 565 (Q_ASSERT(;)

TagsNo tags attached.


2015-04-26 08:27


2015-04-26 08:28




2015-04-26 08:56

developer   ~0013024

Only crashes in debug mode, on release it just confuses the dialog as shown in one of the screenshots.



2015-10-23 12:42

administrator   ~0013406

Colon is not a file system safe character (it's a volume specifier on windows). Probably we should escape that character and any similar ones. It would make sense for Qt to provide a high level interface for this, but I've never found one.

In the past I've used this heuristic:

Is there something better that can be done?



2015-10-24 09:35

developer   ~0013422

Thanks Steve! Escaping the file name makes sense, and I cannot think of anything better right now. We should probably go ahead and implement it in file save dialog.



2015-11-01 08:47

administrator   ~0013472

Hi Csaba -

I could not replicate this with the current build on windows - is it still an issue for you?




2015-11-01 15:38

developer   ~0013473

Thanks for taking the time to look at this issue!
Your test run reminded me that I had applied a workaround back in revision
so that at least there is no crash, see around line
Sorry for not referencing the Mantis issue! If this crude but benign solution is fine, then we can close this ticket.
Unfortunately save data dialog has a number of issues due to its complexity (I discovered some when working on segmentations storage, like the re-use of the fileinfo object, see, so I think it will eventually need an overhaul.



2015-11-03 07:57

administrator   ~0013526

Agreed - there's no doubt a better overall solution but as long as this works to avoid the crash it's a good step.



2015-11-03 10:25

developer   ~0013532

Steve, Jc @ hangout: The best fix would be to "sanitize" file names before saving by replacing a list of "bad" characters with underscores



2015-11-10 13:23

administrator   ~0013582

This fix causes a crash when saving nodes with names like "1" or "4", pull request to avoid the crash:



2015-11-10 13:41

developer   ~0013583

Makes perfect sense, thanks!



2015-11-11 06:54

administrator   ~0013588

Fix is in svn:



2016-02-22 15:32

developer   ~0013821

The reason I haven't closed this issue yet is the suggestion in comment
Should we aim to do that or should I just close the issue?



2016-02-23 09:49

administrator   ~0013822

Hi Csaba - maybe close this and start a child issue as a feature request to sanitize file names? We might want to urlencode illegal characters. -Steve

Related Changesets

Import 2017-06-07 23:51:09: master 088b8182

2015-11-11 11:15:34


Details Diff
BUG: Fix crash on saving node named with a single number

A previous fix[1] to avoid crashes on windows when saving
volumes named "1:xxxx" leads to a crash when a node name
is just a single number (the first part of the check passes, but
crashes when trying to get the second character in the name string).
This fix adds a string length check so that valid node names like
"1" or "2" will not cause a crash on save.


Issue 0003991

git-svn-id: 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/QTGUI/qSlicerSaveDataDialog.cxx Diff File

Issue History

Date Modified Username Field Change
2015-04-26 08:27 pinter New Issue
2015-04-26 08:27 pinter File Added: 20150426_SaveDialogIssue.png
2015-04-26 08:28 pinter File Added: 20150426_SaveFileCrash.png
2015-04-26 08:56 pinter Note Added: 0013024
2015-10-23 12:42 pieper Note Added: 0013406
2015-10-24 09:35 pinter Note Added: 0013422
2015-11-01 08:47 pieper Note Added: 0013472
2015-11-01 15:38 pinter Note Added: 0013473
2015-11-03 07:57 pieper Note Added: 0013526
2015-11-03 10:25 pinter Note Added: 0013532
2015-11-10 13:23 nicole Note Added: 0013582
2015-11-10 13:41 pinter Note Added: 0013583
2015-11-11 06:54 nicole Note Added: 0013588
2016-02-22 15:22 nicole Status new => resolved
2016-02-22 15:22 nicole Resolution open => fixed
2016-02-22 15:22 nicole Assigned To => nicole
2016-02-22 15:32 pinter Note Added: 0013821
2016-02-23 09:49 pieper Note Added: 0013822
2016-02-23 10:41 pinter Status resolved => closed
2016-02-23 10:41 pinter Fixed in Version => Slicer 4.5.1
2016-10-13 02:00 jcfr Fixed in Version Slicer 4.5.1 => Slicer 4.6.0
2017-06-10 08:51 Changeset attached => Slicer master 088b8182