Bug 373119 - QFileDialog sends messages to standard out
Summary: QFileDialog sends messages to standard out
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: Open/save dialogs (show other bugs)
Version: 5.54.0
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-30 18:48 UTC by Teunizz
Modified: 2019-03-03 19:58 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
sSmall test project that demonstrates the problem. (529 bytes, application/gzip)
2016-11-30 18:48 UTC, Teunizz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Teunizz 2016-11-30 18:48:39 UTC
Created attachment 102551 [details]
sSmall test project that demonstrates the problem.

Consider the attached test project that uses QFileDialog.
It shows the following in the console:

kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find ""
kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find ""
Invalid URL: QUrl("abcdefgh.edf")
Invalid URL: QUrl("abcdefgh.edf")

OS is openSuse Leap 42.2, plasmashell 5.8.3.

Sidenote:

First, my application crashed two times at the same point but now I can't reproduce it anymore.
The output was the following:

kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find ""
Invalid URL: QUrl("waveform.edf")
Invalid URL: QUrl("waveform.edf")
kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find ""
kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find ""
Segmentation fault (core dumped)

Output of dmesg:

dsremote[2565]: segfault at 7fbfadfd866c ip 00007fbfa19d6cdc sp 00007ffe832e6668 error 7 in libKF5Notifications.so.5.26.0[7fbfa19c1000+49000]

Application was compiled with the default Qt5 libs coming from the openSuse repo.

Recompiling the same code with Qt4.8.7 does not produce segfaults or any warnings. (Qt4 was compiled from source, downloaded from qt.io)
Comment 1 fabrice salvaire 2017-01-24 12:56:10 UTC
I reproduced this very annoying bug with Valentina https://bitbucket.org/dismine/valentina

The code is

  String fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),                                                   
     qApp->ValentinaSettings()->GetPathLayout()+"/"+FileName()+".pdf", tr("PDF file (*.pdf)"))

I receive this message

 kf5.kio.core: Invalid URL: QUrl("...pdf")

before the dialog open and each time I type something in the filename widget.

The issue is not in Valentina and Qt, Your are doing something nasty with kf5. Monkey patching ???

Links to relevant issues:

https://bitbucket.org/dismine/valentina/issues/613/invalid-url-warning-when-saving-file
https://bugreports.qt.io/browse/QTBUG-56626
Comment 2 fabrice salvaire 2017-01-24 12:58:23 UTC
KF5 is Fedora 25 kf5-kio-core-libs-5.29.0-1.fc25.x86_64
Comment 3 Christoph Feck 2017-01-24 23:49:37 UTC
Confirmed also with qpdfview "Save As".
Comment 4 Elvis Stansvik 2017-02-01 10:09:54 UTC
I'm running into this issue with our product on Ubuntu 16.04 as well (KF5 5.18.0 and Qt 5.5.1), though we're only getting the "Invalid URL: QUrl("blahblah")" messages.

Our QFileDialog is configured and shown as follows:

    QFileDialog *dialog = new QFileDialog(this, "Select CSV File Name");
    dialog->setModal(true);
    dialog->setNameFilter("CSV Files (*.csv)");
    dialog->setDirectory(QFileInfo(outputFileEdit->text()).dir());
    dialog->setLabelText(QFileDialog::Accept, "OK");
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->setFileMode(QFileDialog::AnyFile);
    dialog->setAcceptMode(QFileDialog::AcceptSave);
    dialog->selectFile(outputFileEdit->text());

    connect(dialog, &QFileDialog::fileSelected, outputFileEdit, &QLineEdit::setText);

    dialog->show();

Since we're initially targeting Ubuntu 16.04 exclusively with this product (and using the packaged versions of KF5 and Qt), does anyone know if there's a workaround to quench the messages?
Comment 5 Teunizz 2017-09-10 08:55:31 UTC
Any news?
Comment 6 Christoph Feck 2017-10-05 00:13:39 UTC
I can no longer reproduce with recent versions, so I guess it was fixed in the meantime.
Comment 7 Teunizz 2017-10-05 06:28:21 UTC
Still present here:

guv@cetriolo:/data/guv/c/KDE_bugs> ./test
Invalid URL: QUrl("abcdefgh.edf")
Invalid URL: QUrl("abcdefgh.edf")
guv@cetriolo:/data/guv/c/KDE_bugs> plasmashell --version
plasmashell 5.8.6
guv@cetriolo:/data/guv/c/KDE_bugs>
Comment 8 Christoph Feck 2017-10-18 10:49:27 UTC
Retracting status according to comment #6.

If you can still reproduce with recent versions (e.g. openSUSE Tumbleweed ISO), please add a comment.
Comment 9 Mikle 2017-11-08 17:03:02 UTC
when trying to create a new folder in a dolphin or desktop(plasma->view folder)
the Invalid URL: QUrl ("") pops up. But in the conqueror folders are created without problems. In the console only:
mike [ ~ ]$ dolphin
kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find "stash"
kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find "mtp"
kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find "mtp"
kf5.kio.core: Refilling KProtocolInfoFactory cache in the hope to find "mtp"
qt.accessibility.core: Cannot create accessible child interface for object:  PlacesView(0xfc6740)  index:  25
Empty filename passed to function
Empty filename passed to function
Empty filename passed to function
Empty filename passed to function
Empty filename passed to function
Empty filename passed to function
Empty filename passed to function
The desktop entry file "/home/mike/.directory" has Type= "Application" but no Exec line
kf5.kio.core: Invalid URL: QUrl("")

version of qt-5.9.2 frameworks-5.39 plasma-5.11.2 dolphin-17.08.2
all compiling from source(LFS), 
66/5000

previously collected versions (qt-5.9.2\5.37,38\17.04...08.0) worked flawlessly, it all started after frameworks-5.39 plasma-5.11.2 dolphin-17.08.2.

building with qt5-git(aka 5.10.0)have not changed this situation.
Comment 10 Peter Wu 2019-02-15 01:49:21 UTC
The bug is not in plasma-integration, but the kfiledialog in kio.

Proposed patch: https://phabricator.kde.org/D19027
Comment 11 Peter Wu 2019-03-03 19:58:16 UTC
Git commit d8fcc1e8c62c37f122350ce045a4f22e489be855 by Peter Wu.
Committed on 03/03/2019 at 19:56.
Pushed by peterwu into branch 'master'.

Fix "Invalid URL: QUrl("some.txt")" warnings in Save dialog

When the Save File dialog is in use with filters, any relative path
would trigger warnings due to KIO::stat receiving an invalid URL in
KFileWidgetPrivate::updateLocationEditExtension. Fix the warning by
ensuring that relative paths are valid file URLs.

Add a bunch of tests to check the expected properties while at it. These
tests pass regardless of the fix but after the fix, warnings are gone.

Differential Revision: https://phabricator.kde.org/D19027

M  +119  -0    autotests/kfilewidgettest.cpp
M  +9    -2    src/filewidgets/kfilewidget.cpp

https://commits.kde.org/kio/d8fcc1e8c62c37f122350ce045a4f22e489be855