Skip to content

Commit

Permalink
pyside: Do not pass “None” to QTreeView.setExpanded()
Browse files Browse the repository at this point in the history
PySide2 crashes otherwise (as of PySide2/Qt 5.15.0):

Received signal 6
#0 0x7fecd2bcea7b base::debug::CollectStackTrace()
#1 0x7fecd299bbaf base::debug::StackTrace::StackTrace()
#2 0x7fecd299bb62 base::debug::StackTrace::StackTrace()
#3 0x7fecd2bcd61e base::debug::(anonymous namespace)::StackDumpSignalHandler()
#4 0x7fed08461210 <unknown>
#5 0x7fed0846118b gsignal
#6 0x7fed08440859 abort
#7 0x7fed08119882 fatal_error.lto_priv.0
#8 0x7fed0811989f Py_FatalError
#9 0x7fed03c8c50b SetError_Argument
#10 0x7fed03c5d64e Shiboken::setErrorAboutWrongArguments()
#11 0x7fece240f259 Sbk_QTreeViewFunc_setExpanded
<shortened>
  • Loading branch information
rear1019 committed Nov 3, 2021
1 parent e7aa6cc commit 80fb661
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spyder/plugins/projects/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ def set_project_dir(self, directory):
self.treewidget.set_root_path(osp.dirname(directory))
self.treewidget.set_folder_names([osp.basename(directory)])
self.treewidget.setup_project_view()
try:

index = self.treewidget.get_index(directory)
if index is not None:
self.treewidget.setExpanded(self.treewidget.get_index(directory),
True)
except TypeError:
pass

def clear(self):
"""Show an empty view"""
Expand Down

0 comments on commit 80fb661

Please sign in to comment.