deleteProject, createProject hang/crash

@Simeon When I was using my backup/restore program for the other problem, I noticed that it was constantly hanging. I got it down to the delete/create commands. I don’t know if I mentioned this before and you answered, but at this point I don’t remember. The below code will delete and create a project 200 times. For me, it will eventually hang Codea at different counts and Codea will crash.

I assume that it’s doing the delete/create process too fast and was wondering if there was some way to know when the delete was properly finished before the create could be started.

I got around the hang for the other problem by deleting Codea on my iPhone and creating the projects without having to delete them first.

viewer.mode=STANDARD

function setup()
    cnt=0
    
    name="000z"
    
    for z=1,200 do  -- delete / create project 200 times
        
        if hasProject(name) then
            print("before delete",z)
            deleteProject(name)
        end
        
        print("before create",z)
        createProject(name)
        
        cnt=cnt+1
        str="-- qwertyuiop  "..cnt
        
        saveProjectTab(name..":".."Test",str)
    end
    
    print("done")
end

Pretty sure this has occasionally been an issue with WebRepo too.

Codea was also hanging/crashing when I was doing a lot of createProject(name) without having to do deleteProject(name). I deleted Codea to get rid of all my projects and did a restore which did just the createProject for all my projects. I had to run it several times (10 to15) to get all the projects restored because of the hanging/crashing.