-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(no joke) nautilus crash #139
Comments
Nautilus' problem is Nautilus' (no joke). The above backtrace shows an issue in libfm's |
@palinek? You see hidden NULLs better than I do. |
I see the crash of nautilus here and managed it to not crash with this: diff --git a/src/utilities.cpp b/src/utilities.cpp
index c4351b2..4f52190 100644
--- a/src/utilities.cpp
+++ b/src/utilities.cpp
@@ -114,7 +114,8 @@ void pasteFilesFromClipboard(const Fm::FilePath& destPath, QWidget* parent) {
}
}
-void copyFilesToClipboard(const Fm::FilePathList& files) {
+static void setFilesToClipboard(const Fm::FilePathList& files, bool isCut)
+{
QClipboard* clipboard = QApplication::clipboard();
QMimeData* data = new QMimeData();
QByteArray ba;
@@ -124,28 +125,26 @@ void copyFilesToClipboard(const Fm::FilePathList& files) {
data->setData(QStringLiteral("text/x-libfmqt-pid"), ba.setNum(QCoreApplication::applicationPid()));
// Gnome, LXDE, and XFCE
// Note: the standard text/urilist format uses CRLF for line breaks, but gnome format uses LF only
- data->setData("x-special/gnome-copied-files", QByteArray("copy\n") + urilist.replace("\r\n", "\n"));
+ QByteArray gnome_copied_files;
+ gnome_copied_files.reserve(5/*copy/cut\n*/ + urilist.size() + files.size() + 1);
+ gnome_copied_files += isCut ? "cut\n" : "copy\n";
+ gnome_copied_files += urilist.replace("\r\n", "\n");
+ // Note: the trailing \n can make nautilus crash on assertion
+ gnome_copied_files.chop(1);
+ data->setData("x-special/gnome-copied-files", gnome_copied_files);
// The KDE way
data->setData("text/uri-list", urilist);
- // data->setData(QStringLiteral("application/x-kde-cutselection"), QByteArrayLiteral("0"));
+ if (isCut)
+ data->setData(QStringLiteral("application/x-kde-cutselection"), QByteArrayLiteral("1"));
clipboard->setMimeData(data);
}
-void cutFilesToClipboard(const Fm::FilePathList& files) {
- QClipboard* clipboard = QApplication::clipboard();
- QMimeData* data = new QMimeData();
- QByteArray ba;
- auto urilist = pathListToUriList(files);
+void copyFilesToClipboard(const Fm::FilePathList& files) {
+ setFilesToClipboard(files, false);
+}
- // Add current pid to trace cut/copy operations to current app
- data->setData(QStringLiteral("text/x-libfmqt-pid"), ba.setNum(QCoreApplication::applicationPid()));
- // Gnome, LXDE, and XFCE
- // Note: the standard text/urilist format uses CRLF for line breaks, but gnome format uses LF only
- data->setData("x-special/gnome-copied-files", QByteArray("cut\n") + urilist.replace("\r\n", "\n"));
- // The KDE way
- data->setData("text/uri-list", urilist);
- data->setData(QStringLiteral("application/x-kde-cutselection"), QByteArrayLiteral("1"));
- clipboard->setMimeData(data);
+void cutFilesToClipboard(const Fm::FilePathList& files) {
+ setFilesToClipboard(files, true);
}
bool isCurrentPidClipboardData(const QMimeData& data) { ... the problem with nautilus is, that it doesn't allow the trailing '\n' in But I wasn't able to reproduce the crash of pcmanfm-qt/libfm-qt... UPDATE: |
@palinek I don't understand how https://github.com/lxde/libfm-qt/tree/clipboard_fixes may prevent a crash in Naultilus! As for a crash in libfm-qt, the only possibility that comes to my mind is that, somehow, |
Because nautilus doesn't expect, that the data in
=> so if file(s) is/are cut in pcmafm-qt/libfm-qt ... nautilus parses it as the last one file being an empty string ... and somewhere deeper in the code is assertion that the file can't be empty string ... that's all |
OK. A workaround for Nautilus in libfm-qt! I'm a little suspicious but if it has no side effect.... |
Oh, I'm very suspicious now: I cut a file in pcmanfm-qt and pasted it in spacefm. Everything was OK. After that, I installed that crap that's called Nautilus and run it from terminal. Crash:
And the trace:
I don't think it's worth changing libfm-qt. |
Yes, that's the trace...:
|
We shouldn't do anything for it, IMO. |
I repeated the same test with Thunar: Everything is OK. Let Nautilus' devs fix that if they want to. |
I think there is no problem by not assembling the trailing '\n' in libfm-qt. Btw. the spacefm-gtk3 makes nautilus crash the very same way as libfm-qt does. |
Yes!
We can't be sure about probable consequences completely. As I said before, in my opinion, Nautilus's problem is Nautilus's -- no joke! |
sorry about this path then (btw. the title was meant more as a joke). |
I also think this bug is introduced in Nautilus recently -- otherwise, something like this would be reported a long time ago. |
BTW, cut/copy/paste between Nautilus and Dolphin is fun ;) |
/me facepalm :P |
Closing because this isn't our bug. |
Something is not correct with the copy/cut->paste in libfm-qt
This seems to be an issue with the clipboard implementation of libfm-qt as the following example program crashes for me too. I suspect depending on the place of the crash that somehow the clipboard data does not look exactly like it should or _convertPath not converting like expected.
where the crash is interestingly in path.h::386 which serves the same purpose as the thing nautilus crashes with
The text was updated successfully, but these errors were encountered: