Skip to content

VNADatabaseWillDeleteFolderNotification race condition #1987

@Eitot

Description

@Eitot

I came across this while working on #1986.

// Send the pre-delete notification before we start the transaction so that the handlers can
// safely do any database access.
for (folder in arrayOfChildFolders) {
numFolder = @(folder.itemId);
[arrayOfFolderIds addObject:numFolder];
[[NSNotificationCenter defaultCenter] vna_postNotificationOnMainThreadWithName:VNADatabaseWillDeleteFolderNotification object:numFolder];
}
// Now do the deletion.
result = [self wrappedDeleteFolder:folderId];

wrappedDeleteFolder: is sent after the notification is posted, but before any notification observers are notified. ActivityLog and RefreshManager use this notification to retrieve the folder from the database using the provided folder identifier, but by that time the folder has been deleted already.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions