FileProvider icon indicating copy to clipboard operation
FileProvider copied to clipboard

Downloading multiple files. Crash with pointer being freed was not allocated.

Open s83230p opened this issue 6 years ago • 1 comments
trafficstars

I'm using WebDAVFileProvider to download about 2000 icons using the following function:

func copyPicons(piconList: [String]) {
    let fileManager = FileManager.default
    let documentPath = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
    let piconLocalURL = documentPath.appendingPathComponent("picon")
    do {
        try fileManager.removeItem(at: piconLocalURL)
    } catch {
        print(error)
    }
    do {
        try fileManager.createDirectory(at: piconLocalURL, withIntermediateDirectories: true, attributes: nil)
    } catch {
        print(error)
    }
    for piconFile in piconList {
        let remotePath = "/picon/"+piconFile
        let piconFileLocal = piconLocalURL.appendingPathComponent(piconFile)
        let progress = self.webProvider?.copyItem(path: remotePath, toLocalURL: piconFileLocal, completionHandler: nil)
        self.progressLoadPicons.observedProgress = progress
    }
}

The program stops sporadically, sometimes when it has 300 downloaded icons, other times when it has only 2 icons and sometimes even finishes correctly.

The failure (ex. = Thread 3: signal SIGABRT) occurs in the following RemoteSession.swift statement (urlSession (_downloadTask: didFinishDownloadingTo :)

_ = completionHandlersForTasks [session.sessionDescription!]. removeValue (forKey: downloadTask.taskIdentifier)

In the console log it gives the following error:

enigmando(1245,0x700000bdb000) malloc: *** error for object 0x7f8398d6a600: pointer being freed was not allocated enigmando(1245,0x700000bdb000) malloc: *** set a breakpoint in malloc_error_break to debug

s83230p avatar Jan 02 '19 11:01 s83230p

same issue here

JeanetteMueller avatar Jun 15 '20 17:06 JeanetteMueller