Timer causing blender to crash?

Background Info

Im creating an addon that makes a “child” pose bone maintain an offset from a “parent” pose bone but without actually parenting. I’ve tried many bone constraints but none work. For reasons, I cannot parent the bone to the other. Here’s the result of the addon.

What’s the problem?

When I undo/redo, the addon crashes. I’ve done some testing and it appears to be the timer.

import bpy
import mathutils

Welds = [] #List of PoseBones that have "WeldData" custom property

def updateWeld(child):
    if not "WeldData" in child:
        return

    WeldData = child["WeldData"]
    offset = mathutils.Matrix(WeldData["offset"])
    parent = pathToBone(WeldData["parentPath"])

    parCF = getWorldSpace(parent)
    targetCF = parCF @ offset
    newCF = getObjectSpace(child, targetCF)
    
    child.matrix = newCF
    
def updateAllWelds():
    for w in Welds:
        updateWeld(w)

    return 0.5

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)

    if not setup in bpy.app.handlers.load_post: # Ignore
        bpy.app.handlers.load_post.append(setup)

    if not bpy.app.timers.is_registered(updateAllWelds):
        bpy.app.timers.register(updateAllWelds)
    

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):
        unregister_class(cls)

    if setup in bpy.app.handlers.load_post:
        bpy.app.handlers.load_post.remove(setup)


I left out a lot of parts of the code, the full thing is here.

When I comment out everything inside the updateWeld function, there’s no crash. But as soon as I uncomment the first 2 lines, the crash happens. Can somebody help me get rid of the crash issue?

The error:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF62C95BC7D
Module  : c:\Program Files\Blender Foundation\Blender 2.81\blender.exe
The terminal process terminated with exit code: 11