It's not a complete fix, as it just comments out a line that was causing a 'underlying C/C++ object was deleted' error Should revisit is later. For now, this allows the algorithm to run correctly and not crash qgis