MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Dispose

Method Dispose

Source/Engine/Content/Content.cpp:264–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264void ContentService::Dispose()
265{
266 IsExiting = true;
267
268 // Save assets registry before engine closing
269 Cache.Save();
270
271 // Flush objects (some asset-related objects/references may be pending to delete)
272 ObjectsRemovalService::Flush();
273
274 // Unload all remaining assets
275 {
276 ScopeLock lock(AssetsLocker);
277
278 for (auto i = Assets.Begin(); i.IsNotEnd(); ++i)
279 {
280 i->Value->DeleteObject();
281 }
282 }
283
284 // Flush objects (some assets may be pending to delete)
285 ObjectsRemovalService::Flush();
286
287 // NOW dispose graphics device - where there is no loaded assets at all
288 Graphics::DisposeDevice();
289
290#if PLATFORM_THREADS_LIMIT > 1
291 // Exit all load threads
292 for (auto thread : LoadThreads)
293 thread->NotifyExit();
294 LoadTasksSignal.NotifyAll();
295 for (auto thread : LoadThreads)
296 thread->Join();
297 LoadThreads.ClearDelete();
298#endif
299 Delete(MainLoadThread);
300 MainLoadThread = nullptr;
301 ThisLoadThread = nullptr;
302
303#if PLATFORM_THREADS_LIMIT > 1
304 // Cancel all remaining tasks (no chance to execute them)
305 LoadTasks.CancelAll();
306#else
307 for (auto* e : LoadTasks)
308 e->Cancel();
309 LoadTasks.Clear();
310 LoadTasks.SetCapacity(0);
311#endif
312}
313
314IAssetFactory::Collection& IAssetFactory::Get()
315{

Callers

nothing calls this directly

Calls 13

DeleteFunction · 0.85
DeleteObjectMethod · 0.80
NotifyExitMethod · 0.80
CancelAllMethod · 0.80
FlushFunction · 0.50
SaveMethod · 0.45
BeginMethod · 0.45
IsNotEndMethod · 0.45
JoinMethod · 0.45
ClearDeleteMethod · 0.45
CancelMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected