mapeditor/tiled

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Tiled tries to scan the entire home directory, making it freeze #3823

nbouteme posted onGitHub

Describe the bug Tiled freezes after a few minutes of usage. I recompiled Tiled in order to get a stack trace and symbols.

(gdb) fr 4 #4 0x00007fca4531f16b in Tiled::ProjectModel::folderScanned (this=0x55c99bf22e10, resultPointer=0x7fca240013f0) at /home/user/tiled/src/tiled/projectmodel.cpp:457 457 mWatcher.addPaths(newDirectories); (gdb) p newDirectories.length() $3 = 291732

Even opening a tilemap in a completely empty folder deep in the hierarchy causes Tiled to scan the home folder, even if the CWD isn't even set to that either.

To Reproduce

  1. Start tiled, open a tmx tilemap
  2. Use or don't use a few minutes
  3. Tiled freezes

Expected behavior Doesn't scan my entire home. If I'm not opening a project then it shouldn't scan anything at all that's not referenced by the currently opened files.

Specifications:

  • OS: ArchLinux
  • Tiled Version: Current master branch

If I'm not opening a project then it shouldn't scan anything at all that's not referenced by the currently opened files.

Tiled might be looking for template files. Templates do not requite a project to use, and may be desirable even if they're not already in use by any open documents. To entirely avoid the need to scan files, templates would need to be tied to projects, which is probably not desirable.

Of course, that's not an excuse for Tiled to freeze xP

posted by eishiya over 1 year ago

Tiled might be looking for template files. Templates do not requite a project to use, and may be desirable even if they're not already in use by any open documents.

Hmm, no, Tiled does not actively scan for template files, it just loads those on-demand. But it does scan the project folders, so it would scan the entire home directory, if it is set as a folder in the project.

I think two things need to be done:

  • Since @nbouteme implied they did not load a project under "Expected behavior", there might be a bug that causes Tiled to scan the home folder somehow. Or maybe Tiled just restored the project that was open the last time, and the project really has the home folder as one of its folders?

  • Even if somebody adds the root or home folder to the project, it is likely by accident and Tiled could be a little smarter, for example:

    • We could explicitly check whether the folder is the home folder or one of its parents and refuse to scan it at all.

    • A reasonable folder limit could be set, at which point Tiled would abort the scanning process. Of course, as is usually the case with "reasonable limits", somebody will eventually run into it with a large project, so this would need to be configurable.

posted by bjorn over 1 year ago

I'm not very familiar with Tiled, sorry. Apparently it's because I had created a project in my home directory (which is a mess of over 500 directories and half a million if you include nested dirs, I'll give you that), which caused it to crash, then in later invocations I simply passed the .tmx file I was working on as an argument and it still implicitly opened the same project file and triggered a rescan, so my initial assumption that I wasn't opening a project file was wrong.

This is thus solved by explicitly closing the last opened project (and restarting in case it's not enough to stop the scan) then either working on standalone tmx files or creating a project in a clean hierarchy.

I don't know if you want to keep this open to address the issue of scan limits/scanning home accidentally or if it should be its own issue, but thanks for the insights.

posted by nbouteme over 1 year ago

That's exactly why it's usually discouraged to have projects directly in your home directory. (Scanning folders for stuff is not a thing limited to Tiled)

posted by Zireael07 over 1 year ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests