MayaFlux 0.4.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 63 of file WindowManager.cpp.

64{
65 if (!window)
66 return;
67
68 auto pr_it = std::ranges::find(m_processing_windows, window);
69 if (pr_it != m_processing_windows.end()) {
70 m_processing_windows.erase(pr_it);
71 }
72
73 const std::string title = window->get_create_info().title;
74 remove_from_lookup(window);
75
76 auto it = std::ranges::find(m_windows, window);
77 if (it != m_windows.end()) {
78 m_windows.erase(it);
80 "Destroyed window '{}' - remaining: {}", title, m_windows.size());
81 }
82
83 if (!cleanup_backend) {
84 return;
85 }
86
87 if (m_terminate.load()) {
88 window->destroy();
89 } else {
91 window->destroy();
92 });
93 }
95 "Backend resources for window '{}' cleaned up", title);
96}
#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 Dispatch.hpp:107

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: