Bug 502305

Summary: crash after closing the app after closing the save as dialog
Product: [Frameworks and Libraries] frameworks-kio Reporter: Jaime Torres <jtamate>
Component: Open/save dialogsAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: crash CC: aleixpol, kdedev, kdelibs-bugs-null, nate
Priority: NOR    
Version First Reported In: 6.11.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jaime Torres 2025-04-02 07:26:05 UTC
SUMMARY
First reported in okular as bug 501796.
The Save As dialogue is currently quite slow to appear and to hide (up to 5 seconds).
I opened any pdf and told okular to save as another pdf. Right after closing the save as dialogue, I close okular and then crash.
Within valgrind, I can reproduce it with kwrite also.

STEPS TO REPRODUCE
1. use "valgrind kwrite" (In this way it is just easier to reproduce).
2. use the "Save As" dialogue and choose a not existing file name.
3. As soon as the Save As dialogue is closed, exit kwrite with the red cross in the border or alt-f4.
3. I have to tell kwin to wait for the application to finish, then crash.

OBSERVED RESULT
==291811==    at 0x484EC7C: realloc (vg_replace_malloc.c:1801)
==291811==    by 0x66A3EE7: QArrayData::reallocateUnaligned(QArrayData*, void*, long long, long long, QArrayData::AllocationOption) (qarraydata.cpp:244)
==291811==    by 0x664ABF2: UnknownInlinedFun (qarraydata.h:155)
==291811==    by 0x664ABF2: UnknownInlinedFun (qarraydataops.h:275)
==291811==    by 0x664ABF2: QByteArray::reallocData(long long, QArrayData::AllocationOption) (qbytearray.cpp:1989)
==291811==    by 0x651FB2E: QByteArray::reserve(long long) (qbytearray.h:641)
==291811==    by 0x677A521: UnknownInlinedFun (qstringconverter.h:192)
==291811==    by 0x677A521: QSettingsPrivate::iniEscapedString(QString const&, QByteArray&) (qsettings.cpp:653)
==291811==    by 0x685A06E: UnknownInlinedFun (qsettings.cpp:692)
==291811==    by 0x685A06E: QConfFileSettingsPrivate::writeIniFile(QIODevice&, QMap<QSettingsKey, QVariant> const&) [clone .isra.0] (qsettings.cpp:1856)
==291811==    by 0x6781D61: QConfFileSettingsPrivate::syncConfFile(QConfFile*) (qsettings.cpp:1481)
==291811==    by 0x6781FD9: QConfFileSettingsPrivate::sync() (qsettings.cpp:1304)
==291811==    by 0x677BC18: UnknownInlinedFun (qsettings.cpp:1310)
==291811==    by 0x677BC18: QSettings::~QSettings() (qsettings.cpp:2739)
==291811==    by 0x556B041: QFileDialogPrivate::saveSettings() (qfiledialog.cpp:2811)
==291811==    by 0x555D7AE: .LTHUNK1.lto_priv.6 (qfiledialog.cpp:378)
==291811==    by 0x5568CED: UnknownInlinedFun (qfiledialog.cpp:386)
==291811==    by 0x5568CED: UnknownInlinedFun (qdialog_p.h:109)
==291811==    by 0x5568CED: QFileDialog::getSaveFileUrl(QWidget*, QString const&, QUrl const&, QString const&, QString*, QFlags<QFileDialog::Option>, QList<QString> const&) (qfiledialog.cpp:2495)
==291811==    by 0x1AAFC75C: Okular::Part::slotSaveFileAs(bool) [clone .part.0] (part.cpp:2597)
==291811==    by 0x1AAA9306: Okular::Part::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_part.cpp:709)
==291811==    by 0x65FFFC0: void doActivate<false>(QObject*, int, void**) (qobject.cpp:4127)

SOFTWARE/OS VERSIONS
Qt Version: 6.8.2
Frameworks Version: 6.11.0
Operating System: Linux 6.13.6-1-default x86_64
Windowing System: Wayland
Distribution: "openSUSE Tumbleweed"
Comment 1 Nate Graham 2025-04-02 20:20:05 UTC
Are you using Okular as a Flatpak or something such that you're sure it's using the save dialog using xdg-desktop-portal?
Comment 2 Jaime Torres 2025-04-04 06:58:13 UTC
Not that I'm aware. It is in /usr/bin/okular. 
ldd -r /usr/bin/okular
        linux-vdso.so.1 (0x00007f828ad35000)
        libKF6Parts.so.6 => /lib64/libKF6Parts.so.6 (0x00007f828ac62000)
       ......
But I have xdg-desktop-portal (xdg-desktop-portal-kde6) installed to use the kde file dialog in some gtk programs like firefox.
Comment 3 Nate Graham 2025-04-04 14:34:25 UTC
This means it's not using the portal-based dialog, but rather just the normal one.
Comment 4 Jaime Torres 2025-07-17 07:51:19 UTC
I've discovered why it took so much time opening/closing.

The file .config/QtProject.conf was corrupt with a lot of binary data (more than 1Mb) after the text entries.

Once removed the corrupt file, it was recreated with only the text entries and now the opening/closing of the dialog is instantaneous.
Comment 5 Nate Graham 2025-07-17 14:34:59 UTC
Gross! That'll go through a Qt codepath we don't have any control over, unfortunately. If you have the corrupted file, attaching it to a new Qt bug report might be useful.