Description

The async execution from within the context menu state is not cancelled properly when closing the context menu. This means that when rapidly opening and closing context menus there will be corruption due to partial state overwrites, which can cause all sorts of undesirable effects. This should be guarded against.

Steps to Reproduce

1) Open a project with a decent amount of files and make sure the editor is connected to perforce(we're using perforce so calling it out specifically).

2) Open the content browser.

3) On the left-hand side of the content browser, where all the folders are listed in a tree, start right-clicking quickly on different folders.

4) Usually on the 2-nd/3-rd click, the editor will crash or stall.

Callstack

>    [Inline Frame] UnrealEditor-PerforceSourceControl.dll!TSparseArray<TSetElement<TTuple<FString,TSharedRef<FPerforceSourceControlState,1>>>,TSparseArrayAllocator<TSizedDefaultAllocator<32>,FDefaultBitArrayAllocator>>::AllocateIndex(int) Line 94    C++
     UnrealEditor-PerforceSourceControl.dll!TSparseArray<TSetElement<TTuple<FString,TSharedRef<FPerforceSourceControlState,1>>>,TSparseArrayAllocator<TSizedDefaultAllocator<32>,FDefaultBitArrayAllocator>>::AddUninitialized() Line 134    C++
     UnrealEditor-PerforceSourceControl.dll!TSet<TTuple<FString,TSharedRef<FPerforceSourceControlState,1>>,TDefaultMapHashableKeyFuncs<FString,TSharedRef<FPerforceSourceControlState,1>,0>,FDefaultSetAllocator>::Emplace<TPairInitializer<FString const &,TSharedRef<FPerforceSourceControlState,1> const &>>(TPairInitializer<FString const &,TSharedRef<FPerforceSourceControlState,1> const &> && Args, bool * bIsAlreadyInSetPtr) Line 717    C++
     [Inline Frame] UnrealEditor-PerforceSourceControl.dll!TMapBase<FString,TSharedRef<FPerforceSourceControlState,1>,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FString,TSharedRef<FPerforceSourceControlState,1>,0>>::Emplace(const FString &) Line 404    C++
     [Inline Frame] UnrealEditor-PerforceSourceControl.dll!TMapBase<FString,TSharedRef<FPerforceSourceControlState,1>,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FString,TSharedRef<FPerforceSourceControlState,1>,0>>::Add(const FString &) Line 362    C++
     UnrealEditor-PerforceSourceControl.dll!FPerforceSourceControlProvider::GetStateInternal(const FString & Filename) Line 102    C++
     UnrealEditor-PerforceSourceControl.dll!FPerforceSourceControlProvider::GetState(const TArray<FString,TSizedDefaultAllocator<32>> & InFiles, TArray<TSharedRef<ISourceControlState,1>,TSizedDefaultAllocator<32>> & OutState, EStateCacheUsage::Type InStateCacheUsage) Line 314    C++
     UnrealEditor-AssetManagerEditor.dll!FAssetSourceControlContextMenuState::TryCacheCanExecuteVars(const TArray<FString,TSizedDefaultAllocator<32>> & InSelectedPaths, TArray<FString,TSizedDefaultAllocator<32>> * OptionalPathsWithUnknownState) Line 1050    C++
     UnrealEditor-AssetManagerEditor.dll!FAssetSourceControlContextMenuState::NextAsyncState::__l7::<lambda>() Line 998    C++
     [Inline Frame] UnrealEditor-AssetManagerEditor.dll!SetPromise(TPromise<void> &) Line 63    C++
     UnrealEditor-AssetManagerEditor.dll!TAsyncQueuedWork<void>::DoThreadedWork() Line 230    C++
     UnrealEditor-Core.dll!FQueuedThreadPoolWrapper::FScheduledWork::DoThreadedWork() Line 128    C++
     [Inline Frame] UnrealEditor-Core.dll!FQueuedLowLevelThreadPool::AddQueuedWork::__l2::<lambda_9ed0233657edd7a72d2d0baa6df6647d>::operator()() Line 467    C++
     UnrealEditor-Core.dll!LowLevelTasks::FTask::Init::__l15::<lambda>(const bool bNotCanceled) Line 499    C++
     [Inline Frame] UnrealEditor-Core.dll!Invoke(LowLevelTasks::FTask::Init::__l15::LowLevelTasks::FTask * <lambda>(const bool) &) Line 47    C++
     [Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<LowLevelTasks::FTask * <lambda>(const bool),0>::Call(void *) Line 162    C++
     UnrealEditor-Core.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<LowLevelTasks::FTask * <lambda>(const bool),0>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> & Destination, void * InlineData, unsigned int DestInlineSize, bool <Params_0>) Line 171    C++
     [Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> &) Line 308    C++
     UnrealEditor-Core.dll!LowLevelTasks::FTask::ExecuteTask() Line 627    C++
     UnrealEditor-Core.dll!LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask * & InOutTask) Line 172    C++
     UnrealEditor-Core.dll!LowLevelTasks::FScheduler::TryExecuteTaskFrom<LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue,&LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue::DequeueGlobal,0>(LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue * Queue, LowLevelTasks::TLocalQueueRegistry<1024>::FOutOfWork & OutOfWork, bool bPermitBackgroundWork, bool bDisableThrottleStealing) Line 350    C++
     UnrealEditor-Core.dll!LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::FSleepEvent * WorkerEvent, LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool bPermitBackgroundWork) Line 378    C++
     [Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda_be2218a0adc66e92e8734764b1b5dd37>::operator()() Line 70    C++
     [Inline Frame] UnrealEditor-Core.dll!Invoke(LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda_be2218a0adc66e92e8734764b1b5dd37> &) Line 47    C++
     UnrealEditor-Core.dll!UE::Core::Private::Function::TFunctionRefCaller<<lambda_be2218a0adc66e92e8734764b1b5dd37>,void __cdecl(void)>::Call(void * Obj) Line 475    C++
     [Inline Frame] UnrealEditor-Core.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 600    C++
     UnrealEditor-Core.dll!FThreadImpl::Run() Line 67    C++
     UnrealEditor-Core.dll!FRunnableThreadWin::Run() Line 149    C++
     UnrealEditor-Core.dll!FRunnableThreadWin::GuardedRun() Line 71    C++
     [External Code]    

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-199332 in the post.

0
Login to Vote

Backlogged
ComponentUE - Editor - Workflow Systems
Affects Versions5.2
CreatedOct 31, 2023
UpdatedJan 20, 2024