MCPcopy Create free account
hub / github.com/SFML/SFML / unregisterUnsharedGlObject

Method unregisterUnsharedGlObject

src/SFML/Window/GlContext.cpp:483–501  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

481
482////////////////////////////////////////////////////////////
483void GlContext::unregisterUnsharedGlObject(std::shared_ptr<void> object)
484{
485 if (const std::lock_guard lock(Impl::getUnsharedGlObjectsMutex());
486 const auto unsharedGlObjects = Impl::getWeakUnsharedGlObjects().lock())
487 {
488 // Find the object in unshared objects and remove it if its associated context is currently active
489 // This will trigger the destructor of the object since shared_ptr
490 // in unshared objects should be the only one existing
491 const auto iter = std::find_if(unsharedGlObjects->begin(),
492 unsharedGlObjects->end(),
493 [&object](const Impl::UnsharedGlObject& obj) {
494 return (obj.object == object) &&
495 (obj.contextId == GlContextImpl::CurrentContext::get().id);
496 });
497
498 if (iter != unsharedGlObjects->end())
499 unsharedGlObjects->erase(iter);
500 }
501}
502
503
504////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 3

eraseMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected