MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ destroy_window()

void MayaFlux::Core::WindowManager::destroy_window ( const std::shared_ptr< Window > &  window,
bool  cleanup_backend = false 
)

Destroys a window by pointer.

Parameters
windowPointer to window to destroy
cleanup_backendIf true, also cleans up backend resources

Definition at line 58 of file WindowManager.cpp.

59{
60 if (!window)
61 return;
62
63 auto pr_it = std::ranges::find(m_processing_windows, window);
64 if (pr_it != m_processing_windows.end()) {
65 m_processing_windows.erase(pr_it);
66 }
67
68 const std::string title = window->get_create_info().title;
69 remove_from_lookup(window);
70
71 auto it = std::ranges::find(m_windows, window);
72 if (it != m_windows.end()) {
73 m_windows.erase(it);
75 "Destroyed window '{}' - remaining: {}", title, m_windows.size());
76 }
77
78 if (!cleanup_backend) {
79 return;
80 }
81
82 if (m_terminate.load()) {
83 window->destroy();
84 } else {
86 window->destroy();
87 });
88 }
90 "Backend resources for window '{}' cleaned up", title);
91}
#define MF_INFO(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::atomic< bool > m_terminate
std::vector< std::shared_ptr< Window > > m_windows
void remove_from_lookup(const std::shared_ptr< Window > &window)
Removes window from lookup table.
std::vector< std::shared_ptr< Window > > m_processing_windows
@ WindowingSubsystem
Windowing system operations (GLFW, SDL)
@ Core
Core engine, backend, subsystems.
auto dispatch_main_sync(Func &&func, Args &&... args) -> decltype(auto)
Definition Parallel.hpp:110

References MayaFlux::Journal::Core, MayaFlux::Parallel::dispatch_main_sync(), m_processing_windows, m_terminate, m_windows, MF_DEBUG, MF_INFO, remove_from_lookup(), and MayaFlux::Journal::WindowingSubsystem.

Referenced by destroy_closed_windows(), and destroy_window_by_title().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: