Browser Freezing when Copying

Hello, I am having an issue with my Anki browser. Can anyone help or let me know if they have had a similar problem and how they solved it?

What is happening:
When I am in the browser screen, after copying a piece of text within any field, approximately one second later, the browser freezes. I am unable to click any portion of the window and interact with it, and I cannot paste. After about 5-10 seconds, the window becomes interactive again and I am able to paste the text. This occurs only with text and not with images. This occurs when I use Ctrl+C and when I right click and select “copy.”

To troubleshoot, I have followed the “when problems occur” section of the manual. I am on 2.1.54 Qt5. I tried restarting Anki, opening while holding shift to prevent my add-ons from loading, checking the database, restarting my computer, changing the video driver (tried all 3 options)
My computer should be plenty powerful. I have a AMD Ryzen 5 5600H processor with 32 GB of RAM.

Thank you for your help!

What happens with the Qt6 version?

The same issue occurs on Qt6. I attempted to copy again while none of my addons are loaded, and the exact same event occurred with the “freeze” that stops after ~5-10 seconds after copying

Edit: It appears to no longer be happening at the moment. I will reply again if it starts happening again.

It is back to freezing now with the same behavior as before. Does anyone have any other ideas?

How does Anki 2.1.55 fare?

Still having the issue. With 2.1.55 I have tried starting Anki regularly and in safe mode without my addons running, but it’s still freezing after copying.

Edit: I opened up my task manager to check out CPU, memory etc usage. When I copy within the browser of anki, my CPU utilization goes from ~3% up to about 12%, then when the issue ends it goes back down to ~3%. I don’t know if this is helpful at all.

Is it possible you have some other program running on your computer that monitors the clipboard, such as dictionary tools or clipboard managers? I’m not seeing any such pause here.

I think I have the same issue.
When pressing ‘E’ to edit a card, and then ctrl-c to copy, anki freezes completely. Doesn’t use any CPU though.
It lasts for a while, then it continues like nothing happens. If I do it again, I get a segmentation fault.

Anki 2.1.57 (cef672a6) Python 3.10.9 Qt 6.4.2 PyQt 6.4.0
Platform: Linux-6.1.4-arch1-1-x86_64-with-glibc2.36
No active addons

Are you using GNOME/mutter?

No, KDE (X11).

Do you get the same behaviour with the latest main? The copy/paste handling delay was extended recently.

Yes, still the same issue with

Version ⁨2.1.57 (e15d2f0e)⁩
Python 3.10.9 Qt 6.4.2 PyQt 6.4.0

Freeze in first copy, a crash on the second attempt.

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x00007fffd33c26d0 in ?? () from /usr/lib/qt6/plugins/platforms/../../../
(gdb) bt
#0  0x00007fffd33c26d0 in  () at /usr/lib/qt6/plugins/platforms/../../../
#1  0x00007fffd33c524b in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) () at /usr/lib/qt6/plugins/platforms/../../../
#2  0x00007fffd33cd25e in QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/qt6/plugins/platforms/../../../
#3  0x00007fffd33e43d8 in  () at /usr/lib/qt6/plugins/platforms/../../../
#4  0x00007ffff2b1687b in g_main_context_dispatch () at /usr/lib/
#5  0x00007ffff2b6dc89 in  () at /usr/lib/
#6  0x00007ffff2b15132 in g_main_context_iteration () at /usr/lib/
#7  0x00007ffff334d382 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/
#8  0x00007ffff3135604 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/
#9  0x00007ffff312ce7b in QCoreApplication::exec() () at /usr/lib/
#10 0x00007fffee76247e in  () at /usr/lib/python3.10/site-packages/PyQt6/
#11 0x00007ffff7b55e48 in  () at /usr/lib/
#12 0x00007ffff7b4f4eb in _PyObject_MakeTpCall () at /usr/lib/
#13 0x00007ffff7b4a8ee in _PyEval_EvalFrameDefault () at /usr/lib/
#14 0x00007ffff7b562d9 in _PyFunction_Vectorcall () at /usr/lib/
#15 0x00007ffff7b454d6 in _PyEval_EvalFrameDefault () at /usr/lib/
#16 0x00007ffff7b562d9 in _PyFunction_Vectorcall () at /usr/lib/
#17 0x00007ffff7b4a03f in _PyEval_EvalFrameDefault () at /usr/lib/
#18 0x00007ffff7b44120 in  () at /usr/lib/
#19 0x00007ffff7bf1b94 in PyEval_EvalCode () at /usr/lib/
#20 0x00007ffff7c02323 in  () at /usr/lib/
#21 0x00007ffff7bfda8a in  () at /usr/lib/
#22 0x00007ffff7aa1979 in  () at /usr/lib/
#23 0x00007ffff7aa162a in _PyRun_SimpleFileObject () at /usr/lib/
#24 0x00007ffff7aa1fdd in _PyRun_AnyFileObject () at /usr/lib/
#25 0x00007ffff7c0eb0d in Py_RunMain () at /usr/lib/
#26 0x00007ffff7be336b in Py_BytesMain () at /usr/lib/
#27 0x00007ffff783c290 in  () at /usr/lib/
#28 0x00007ffff783c34a in __libc_start_main () at /usr/lib/
#29 0x0000555555555045 in _start ()

Do you get the same crashes with the Anki binary from Anki’s website?

(post deleted by author)

Ok, thanks for trying. If you’re comfortable building from source, you could try making _flagAnkiText() do nothing, to see if it makes any difference.

Yes, that does fix the issue. There seems to be a problem with “clip.setMimeData(mime)”

Sorry, had to delete the last post - can only have 3 replies ._.

I’ve logged this on Our clipboard handling code seems to cause issues · Issue #2349 · ankitects/anki · GitHub