Error during performing an ahk script

this error did not occur in 2.1.49 version
this error occurs on 2.1.54 Qt5, even after starting anki while holding shift, checking the database,
with restarting the laptop and anki , the problem persisted

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.7 Qt 5.15.2 PyQt 5.15.5
Platform: Windows 10
Flags: frz=True ao=False sv=2
Add-ons, last update check: 2022-09-12 00:56:34

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

the ahk script cleans the unwanted characters and remove new line character

f7::

Clipboard:=""
Send ^c  
Clipwait, 2

Clipboard := StrReplace(Clipboard, "`r`n"," ")
Clipboard := RegExReplace(Clipboard, """", "'")
Clipboard := RegExReplace(Clipboard, "[\Q\/|\*?:\E]", "")

Send ^v 
Send, {Ctrl up}
Return

worked normally in .49 version

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