Bug 502576

Summary: Crash when changing workspaces while screen / window sharing dialog is active
Product: [Applications] konqueror Reporter: Juraj <jurajoravec>
Component: webenginepartAssignee: Konqueror Bugs <konqueror-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: kdedev, stefano.crocco
Priority: NOR    
Version First Reported In: 24.12.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://bugreports.qt.io/browse/QTBUG-136111
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Juraj 2025-04-08 17:53:06 UTC
SUMMARY
Konqueror crashes when the workspaces change (quickly?) when the screen sharing dialog is open.
I use i3 window manager.

STEPS TO REPRODUCE
1. Go to site which provides screen sharing functionality, eg. https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing/
2. Click on "Share Your Screen"
3. Select some window
4. Move to different workspaces with different number of windows. (the number of windows might be related to the bug)

OBSERVED RESULT
Crash

EXPECTED RESULT
Survival

SOFTWARE/OS VERSIONS
Operating System: Artix Linux 
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Graphics Platform: X11
Window Manager: i3


ADDITIONAL INFORMATION
Discovered while testing Falkon MR with similar implementation. https://invent.kde.org/network/falkon/-/merge_requests/94


BACKTRACE
(at least what I managed to get, sorry for missing symbols)

#0  0x00007ffff597c249 in QConcatenateTablesProxyModel::index(int, int, QModelIndex const&) const () at /usr/lib/libQt6Core.so.6
#1  0x00007ffff6bf1aa8 in QAbstractItemView::rowsAboutToBeRemoved(QModelIndex const&, int, int) () at /usr/lib/libQt6Widgets.so.6
#2  0x00007ffff6c210f5 in QListView::rowsAboutToBeRemoved(QModelIndex const&, int, int) () at /usr/lib/libQt6Widgets.so.6
#3  0x00007ffff57adb9a in ??? () at /usr/lib/libQt6Core.so.6
#4  0x00007ffff5960eaf in QAbstractItemModel::beginRemoveRows(QModelIndex const&, int, int) () at /usr/lib/libQt6Core.so.6
#5  0x00007ffff597c4d3 in ??? () at /usr/lib/libQt6Core.so.6
#6  0x00007ffff57adb9a in ??? () at /usr/lib/libQt6Core.so.6
#7  0x00007ffff5960eaf in QAbstractItemModel::beginRemoveRows(QModelIndex const&, int, int) () at /usr/lib/libQt6Core.so.6
#8  0x00007fff75d97f5f in ??? () at /usr/lib/libQt6WebEngineCore.so.6
#9  0x00007ffff57adb9a in ??? () at /usr/lib/libQt6Core.so.6
#10 0x00007fff71a7dce3 in QtWebEngineCore::DesktopMediaListQt::sourceRemoved(int) () at /usr/lib/libQt6WebEngineCore.so.6
#11 0x0000000000000000 in ??? ()
Comment 1 Stefano Crocco 2025-04-19 08:22:48 UTC
I can reproduce the crash, but looking at the backtrace, it doesn't seem to contain anything that is caused by Konqueror code. I think it could be a bug in Qt itself. You said that you discovered this bug while testing a Falkon MR: do you mean that Falkon also crashes this way? If so, I really think it's a Qt bug. By the way, I couldn't reproduce it using Plasma and virtual desktops.
Comment 2 Juraj 2025-04-19 11:18:40 UTC
Hello,
> I think it could be a bug in Qt itself.
Probably? I dont know, I did not work with models and QComboBox before.
Could be a Qt issue or misunderstanding.

> You said that you discovered this bug while testing a Falkon MR: do you mean that Falkon also crashes this way?
With the mentioned MR, yes it crashes in same way with same/similar backtrace.

> By the way, I couldn't reproduce it using Plasma and virtual desktops.
I only tested on X woth i3. It does seem to crash only when number of windows change and the index previously selected window in the comboBox is out of the new bounds... (just a speculation, I did not debug that deep)

PS: I did not use "QConcatenateTablesProxyModel" before, so I do not know if it is indented only for single time display of the data with static source models or if it can handle changes within the source models.
Comment 3 Stefano Crocco 2025-04-22 09:46:04 UTC
I'd never used QConcatenateTablesProxyModel before, either. However, I don't think using it with models which a variable number of rows is the cause of the crash: I tried a test program where some QStringListModels were concatenated in a QConcatenateTablesProxyModel and shown in a QComboBox. Using a QTimer I removed some rows from them, but nothing happened. I think it's only when using it with a QWebEngineDesktopMediaRequest which causes the crash.

I created a Qt bug report about this issue at https://bugreports.qt.io/browse/QTBUG-136111. Let's see what they say
Comment 4 Bug Janitor Service 2025-05-04 08:42:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/konqueror/-/merge_requests/422
Comment 5 Stefano Crocco 2025-05-25 07:41:50 UTC
Git commit cb5c8058144c305a07fff2bc49e1631fcaabb4fc by Stefano Crocco.
Committed on 25/05/2025 at 07:36.
Pushed by stefanocrocco into branch 'master'.

Work around a crash when showing the CaptureSourceChooserDlg

M  +23   -22   webenginepart/src/capturesourcechooserdlg.cpp
M  +18   -8    webenginepart/src/capturesourcechooserdlg.h
M  +81   -18   webenginepart/src/capturesourcechooserdlg.ui

https://invent.kde.org/network/konqueror/-/commit/cb5c8058144c305a07fff2bc49e1631fcaabb4fc