diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py index 2e797970f..3f618a279 100644 --- a/qutebrowser/mainwindow/prompt.py +++ b/qutebrowser/mainwindow/prompt.py @@ -654,6 +654,12 @@ class FilenamePrompt(_BasePrompt): """A prompt for a filename.""" + # Note: This *must* be a class variable! If it's not, for unknown reasons, + # we get a segfault in Qt/PyQt in QFileInfoGatherer::getInfo() if we have + # nested download prompts (i.e. trigger a download while a download prompt + # is open already). + _null_icon_provider = NullIconProvider() + def __init__(self, question, parent=None): super().__init__(question, parent) self._init_texts(question) @@ -753,7 +759,7 @@ class FilenamePrompt(_BasePrompt): self._file_model = QFileSystemModel(self) # avoid icon and mime type lookups, they are slow in Qt6 - self._file_model.setIconProvider(NullIconProvider()) + self._file_model.setIconProvider(self._null_icon_provider) self._file_view.setModel(self._file_model) self._file_view.clicked.connect(self._insert_path) diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature index d07e587ed..df04625a8 100644 --- a/tests/end2end/features/downloads.feature +++ b/tests/end2end/features/downloads.feature @@ -669,6 +669,20 @@ Feature: Downloading things from a website. Then the downloaded file download.bin should exist And the downloaded file download2.bin should not exist + Scenario: Nested download prompts (#8674) + When I set downloads.location.prompt to true + And I open data/downloads/download.bin without waiting + And I wait for "Asking question option=None text=* title='Save file to:'>, *" in the log + And I open data/downloads/download.bin without waiting + And I wait for "Asking question option=None text=* title='Save file to:'>, *" in the log + And I open data/downloads/download.bin without waiting + And I wait for "Asking question option=None text=* title='Save file to:'>, *" in the log + And I run :prompt-accept + And I run :mode-leave + And I run :mode-leave + And I wait until the download is finished + Then the downloaded file download.bin should exist + @qtwebengine_skip # We can't get the UA from the page there Scenario: user-agent when using :download When I open user-agent