Hello! This is really bothering me and I was wondering if anyone has an idea on how to fix this issue?

Whenever I save directly in dropbox, like making a new file entirely, it would keep throwing this error. And when I check the folder I see these:

It's driving me insane and this is something recent. It didn't happen before :(
Hmm, that's an issue with QSaveFile. It's already reported on the Qt bug tracker here:
https://bugreports.qt.io/browse/QTBUG-57299
Until that is fixed, I could add an option to turn off safe writing of files, like they did for TeXstudio.
It's driving me insane and this is something recent. It didn't happen before :(
Do you know since when it is happening? What was the last version that worked? I think I've been using QSaveFile since a while so the bug in Qt may be a regression.
@bjorn It's been a while but I think it's 3 versions back?
It's been a while but I think it's 3 versions back?
Hmm, QSaveFile has been used since at least Tiled 0.13 (the code was there since Tiled 0.10, but only active when compiled against Qt 5, which Tiled 0.13 required). So it may be that this was indeed a regression in Qt at some point.
An option to turn it off would be great! Most of our work is in dropbox because we're working internationally and I can't put it in desktop (the project file and graphics are in DB and updating both so the artist can see it eats so much time ;w;)
Yep, same issue with saving being impossible while Dropbox active. Temporary option to disable safe writing would be wonderful.
I guess the problem is that the file isn't properly closed or opened with the wrong flags in tiled. When i leave to program open with the unsaved map, after hours i can save it again without the error message.
http://doc.qt.io/qt-5/qfile.html
Probably somewhere in there:
bool MapDocument::save(const QString &fileName, QString *error)
{
MapFormat *mapFormat = mWriterFormat;
TmxMapFormat tmxMapFormat;
if (!mapFormat)
mapFormat = &tmxMapFormat;
if (!mapFormat->write(map(), fileName)) {
if (error)
*error = mapFormat->errorString();
return false;
}
undoStack()->setClean();
setFileName(fileName);
mLastSaved = QFileInfo(fileName).lastModified();
emit saved();
return true;
}
@jan-jue I don't think the problem is in Tiled. Note that other applications that have switched from QFile to QSaveFile are affected as well. The code you quoted does not keep any file open and no special flags are being used by Tiled (but may be inside QSaveFile).
Bumping this up!
The issue no longer happens when I 'save'. However, if I try Save As, the bug reappears.
Or not, the bug returned :(
The issue no longer happens when I 'save'. However, if I try Save As, the bug reappears.
Or not, the bug returned :(
Since it is the result of two processes trying to do stuff with the same file in a very short timeframe, I guess it is normal that sometimes it will work. In any case, the snapshot builds will soon feature the option to turn the safe writing of files off.
I hope the option can be removed again once the bug has been fixed in Qt.
I could reproduce how to to avoiding this problem in 0.18.0 @bjorn!
I always have two tmx files open now in the same editor. When the error message pops up, i am closing the message box, then switch the focus to the other open map, and press save. Then i switch focus back to the map i currently want to save. Then the save is possible without problem.
@jan-jue That's an interesting workaround, but I don't think it'll help us doing a reliable fix for this. Did you or @Archeia try whether the new option also avoids the issue?
The only downside to the option is that it may cause data loss if an error happens while writing the map (including out of disk space), but for Dropbox folders this doesn't matter since I believe Dropbox stores older revisions, right? Also it generally won't matter when your file is in version control.
@Archeia Please try my workarround and tell me if it works for you.