Error copying data when editing a note field Anki 2.1.54

Error copying data when editing a note field Anki 2.1.54

I’m getting an error window popping up when I copy text from a note field while editing a note. The error text is:

==============
Error
An error occurred. Please use Tools > Check Database to see if that fixes the problem.
If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.
Anki 2.1.54 (b6a7760c) Python 3.9.10 Qt 6.3.1 PyQt 6.3.1
Platform: Linux
Flags: frz=True ao=False sv=2
Add-ons, last update check: 2022-09-07 18:21:06

Caught exception:
Traceback (most recent call last):
File “aqt.progress”, line 118, in handler
File “aqt.editor”, line 1349, in
RuntimeError: wrapped C/C++ object of type QMimeData has been deleted

Steps to recreate error (Case 1):

  1. Select BROWSE from the top menu.
  2. Select a note to edit.
  3. Highlight some or all text in a note field.
  4. Copy text to clipboard. (Use keyboard shortcut CRTL+c or select COPY from right-clicked popup menu.)
    Error window pops up.

Steps to recreate error (Case 2):
1.Select a deck to review.
2. Begin review.
3. While reviewing a card, select EDIT button on the lower left corner.
4. In popup window, highlight some or all text in a note field.
5. Copy text to clipboard. (Use keyboard shortcut CRTL+c or select COPY from right-clicked popup menu.)
Error window pops up.

In both cases, even though the error window pops up, the selected text has been placed in the clipboard and may be successfully pasted after the error window has been closed.

Additional information about the error:

  1. This is occurring on a Chromebook (Intel 64 bit CPU) running Anki desktop in the Linux Beta (Crostini) Debian 11 Bullseye environment. I CANNOT duplicate the error on my PC laptop (Intel 64 bit CPU) running Debian 11 Bullseye. Copy/paste works fine on that machine. Both machines are running Anki 2.1.54.

  2. Error window does not pop up 100% of the time on the Chromebook. Sometimes, but not always, the first attempt after a reboot will complete without the error window popping up.

  3. Copy/paste used to work without error on Anki 2.1.49. I’m only getting the error after upgrading to 2.1.54.

  4. I can copy text, without getting the error, from a CARD REVIEW screen or from the PREVIEW screen while browsing.

  5. I’ve not loaded any add-ons to either of my Anki installs.

Please let me know if the issue persists when the first 2.1.55 beta comes out.

I downloaded and untar’ed 55 beta 1. I did not do a permanent install, but simply ran Anki from the folder created by the tar command. Below is the output to the terminal window with comments (indicated by ##) when I did something.

cd’ed to anki55 folder

entered ./anki

x@penguin:~/anki-2.1.55-linux-qt6$ ./anki
Anki starting…
Initial setup…
Running with temporary Qt5 compatibility shims.
Run with DISABLE_QT5_COMPAT=1 to confirm compatibility with Qt6.
Preparing to run…
Wayland support is disabled by default due to bugs:

Disabling the http link that AnkiForum refuses to accept.

https://github.com/ankitects/anki/issues/1767
You can force it on with an env var: ANKI_WAYLAND=1
Command ‘dbus-send --session --print-reply=literal --reply-timeout=1000 --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:‘org.freedesktop.appearance’ string:‘color-scheme’’ returned non-zero exit status 1.
Qt info:

GL Type: desktop
Surface Type: OpenGL
Surface Profile: NoProfile
Surface Version: 3.1
QSG RHI Backend: OpenGL
Using Supported QSG Backend: yes
Using Software Dynamic GL: no
Using Multithreaded OpenGL: yes

Init Parameters:

  • application-name Anki
  • browser-subprocess-path /home/x/anki-2.1.55-linux-qt6/lib/PyQt6/Qt6/libexec/QtWebEngineProcess
  • disable-features ConsolidatedMovementXY,InstalledApp,BackgroundFetch,WebOTP,WebPayments,WebUSB,PictureInPicture
  • disable-setuid-sandbox
  • disable-speech-api
  • enable-features NetworkServiceInProcess,TracingServiceInProcess
  • enable-threaded-compositing
  • enable-use-zoom-for-dsf false
  • in-process-gpu
  • use-gl desktop

Starting main loop…
mpv not found, reverting to mplayer

Opened a BROWSE window.

Highlighted some text in the first record displayed.

Copied text to clipboard.

Pasted text to another field in the same record.

So far, so good.

Attempted to repeat the process.

Highlighted some text.

Copied text to clipboard.

Qt warning: QXcbClipboard: Selection request should be caught before

Pasted text to another field in the same record.

Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Qt warning: QXcbClipboard: Selection request should be caught before
Segmentation fault (core dumped)

Anki has crashed.

Without rebooting the Chromebook, I restarted Anki, repeated the steps as above and got similar results.

After restarting Anki again, I tried to repeat the steps as above. This time I was not able to complete a cut/paste. The Qt warning appeared once when I first copied to the clipboard. When I tried to paste, their were no Qt warnings. ‘Segmentation fault (core dumped)’ appeared immediately after and Anki again crashed.

I should add that, unlike Anki54, there were no popup windows with error messages. Just messages in the terminal window.

Better luck next time!

I suspect the issue lies in _flagAnkiText(), though I’m not sure whether the code is doing something wrong or whether it’s triggering a Qt bug. If you’re able to build Anki from source, you could try varying the 10ms delay to something else to see if it makes a difference.

Unfortunately, building from source code is a skill which I’ve not mastered, yet. But your mention of a Qt bug, prompted me to go back and try the Qt5 versions of Anki54 and Anki55. Each produced similar errors to its Qt6 sibling. It seems, to me, that if the bug is in Qt, then it is in Qt5 and Qt6.

Sorry I can’t be more help.