tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Tiled sometimes opens the same map in two separate tabs, causing confusing behaviour (especially in Worlds)

Open floral-qua-floral opened this issue 2 years ago • 1 comments

Took me a while to figure out what was going on - I ended up writing out a whole issue report about the various things I was noticing, such as disappearing maps, changes being reverted/restored seemingly at random, the currently selected layer changing inappropriately when I switch between maps, etc. However when reviewing the video clips I recorded for the bug report, I realized that the issues I was observing seemed to be caused entirely by the fact that Tiled had opened up the same map in multiple tabs. It appears to have been picking between the tabs randomly when deciding what to render whenever I had a different map in the same world selected, and also picking randomly when I click on the world to focus it (the tab it ends up focusing is not always the same one that it was rendering).

Here are the two video clips I recorded, which I initially believed were recordings of some sort of data-loss bug, but I now realize just display the extremely confusing consequences of having the same map open in multiple tabs. Keeping a close eye on the tab bar at the top during these clips sheds light on what's going on here.

Video 1: Changes appearing and disappearing as I swap between maps. https://user-images.githubusercontent.com/49110090/124789780-9069e400-df18-11eb-984b-84905c1a82b1.mp4

Video 2: Maps appearing and disappearing as I swap between maps. A single cluster of ground tiles also appears and disappears at random - at one point when I click on the map with the disappearing tiles, it opens the version that does have them, and immediately afterwards I focus it again, opening the version that doesn't have them. Looking at the tab bar reveals that it is in fact opening two different tabs. About 75% of the way through the clip, I close and reopen Tiled, which syncs them all, superficially fixing the issue - however if I were to continue making changes without closing the duplicate tabs, I would likely end up running into these same problems again. https://user-images.githubusercontent.com/49110090/124792401-f9eaf200-df1a-11eb-9ab3-23815989fa4c.mp4

I'm not sure what exactly resulted in multiple tabs of the same map being opened, though - I'll keep a careful eye out for this and update the report if I figure out how to reproduce that.

floral-qua-floral avatar Jul 07 '21 16:07 floral-qua-floral

Wow, that looks seriously glitchy!

I'm not sure what exactly resulted in multiple tabs of the same map being opened, though - I'll keep a careful eye out for this and update the report if I figure out how to reproduce that.

Yeah, this is the real question that we need to find an answer to.

I wonder if it could be case sensitivity issues, with Tiled thinking they are different maps while they are really the same. In this case the difference might show in the tool tip of the duplicated tabs. I think it's unlikely to be the problem, though.

Another thing could be that it relates to the handling of new maps as they get created / added to the world. When you reopened Tiled, were the duplicated tabs actually restored as duplicates?

Btw, in the final part of the second video, I see you searching for a while for the layer containing some misplaced tiles. In this case, I think it would have helped to use Ctrl + Right Click, which selects the layer containing the top-most tile at the clicked location.

bjorn avatar Jul 07 '21 19:07 bjorn