sublime_text
sublime_text copied to clipboard
Sublime hangs on pasting image data and loses all unsaved data
Description of the bug
Accidentally pasting image data into Sublime Text hangs the program. Closing ST at this point causes it to lose all unsaved data.
Steps to reproduce
- Open Sublime Text 3.
- Create some tabs with unsaved work.
- Close Sublime Text.
- Reopen Sublime Text and see your unsaved work restored.
- Open an image editor and copy a region.
- Paste into a Sublime Text buffer.
- At this point, Sublime Text is partially hung. The cursor is unresponsive but newly entered text is rendered and the line highlight works.
- Close Sublime Text by typing alt+f4.
- Reopen Sublime Text. All unsaved work is lost forever.
FWIW, I tried pasting the same copied data into GIMP and it pasted fine.
Expected behavior
Sublime Text v3 has better ability to restore unsaved work and workspaces.
Actual behavior
Sublime Text crashed and all my unsaved work was lost along with my workspace and open tabs. Obviously, I'm frustrated but the ability to never lose data is a critical feature for text editors.
Sublime Text build number
4126
Operating system & version
Debian 11 bullseye 64b
(Linux) Desktop environment and/or window manager
GNOME v3.38.5
Additional information
No response
OpenGL context information
No response
Note that build 4126 is ST4 not ST3. I'm unable to reproduce this by copying a region from gimp in ubuntu 20.04 gnome 3.36. Does it happen in X11 or Wayland?
Thanks for the reply. Sorry for the wrong version. Build number confirmed from the about menu item. I'm on X11. I cannot repro with GIMP or Krita.
What software can you reproduce it with?
I know it happens with Aseprite (source) as shown in the GIF. I haven't tried anything else beside GIMP and Krita.
This seems to come from Aseprite causing gtk_clipboard_wait_for_text
to hang forever. My guess is that it should be replying that it doesn't have any text to copy, but isn't.
Dang! Thank you for the great sleuthing! :+1: I couldn't find any known issue in Aseprite but it's a pretty niche program.
For me, the biggest issue is that when Sublime Text does hang or crash (whether due to external or internal bugs), it's easy for it to lose data. As far as I'm aware, there's no concept in Sublime of multiple recovery sessions so when something bad happens, that data is gone for good. Recovery sessions don't stack and there's no trick to reviving an outdated one. In Vim, for example, I don't think there's any scenario with a .sw* recovery file is automatically overwritten.
I haven't been able to reproduce any data loss on my end; except for the obvious last ~30s being lost due to any crash. Does it happen consistently for you? Is it losing the whole session or just the most recent changes?
It's a 100% and all unsaved state is lost. Normally, the Sublime background process closes when all application windows are closed. From what I can tell, what happens here is that Sublime runs in a background process despite its only open (and frozen) window being closed. When a new window is opened, that background process is reused (?) and the new window blows away the save state of the frozen window so all data is lost. If there was a history of prior sessions preserved, instead of only a single session, this would never happen. That's the real issue.
I tried to illustrate more explicitly here where I open a Sublime window with preexisting state from launch:
- Grep for Sublime (no processes exist, it's just grep itself matching).
- Launch Sublime. See preexisting unsaved state.
- Modify state.
- Copy in Aseprite.
- Paste in Sublime. Sublime hangs in weird state.
- Press close cross in Sublime.
- Sublime still exists in background process!
- Launch Sublime again. A new window is made instead of restoring state! All prior state lost!
- Close new Sublime window.
- Sublime process is still running so kill Sublime.
- Launch Sublime.
Thanks, I've been able to reproduce that.
Fixed in build 4135.
I confirm the specific hang fix. Thank you!