-
Notifications
You must be signed in to change notification settings - Fork 249
bugfix(gui): Remove destroyed windows from modal stack #3224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,9 +103,6 @@ void GameWindowManager::processDestroyList() | |
| if( m_keyboardFocus == doDestroy ) | ||
| winSetFocus( nullptr ); | ||
|
|
||
| if( (m_modalHead != nullptr) && (doDestroy == m_modalHead->window) ) | ||
| winUnsetModal( m_modalHead->window ); | ||
|
|
||
| if( m_currMouseRgn == doDestroy ) | ||
| m_currMouseRgn = nullptr; | ||
|
|
||
|
|
@@ -1422,8 +1419,7 @@ Int GameWindowManager::winDestroy( GameWindow *window ) | |
| if( m_keyboardFocus == window ) | ||
| winSetFocus( nullptr ); | ||
|
|
||
| if( (m_modalHead != nullptr) && (window == m_modalHead->window) ) | ||
| winUnsetModal( m_modalHead->window ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to fix Then the code can just become if( (m_modalHead != nullptr)
winUnsetModal( window );There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it is correct to remove it from the head only for some of the callers? Maybe we can have 2 functions: Or if we just need |
||
| removeWindowFromModalStack( window ); | ||
|
|
||
| if( m_currMouseRgn == window ) | ||
| m_currMouseRgn = nullptr; | ||
|
|
@@ -1555,6 +1551,26 @@ Int GameWindowManager::winUnsetModal( GameWindow *window ) | |
|
|
||
| } | ||
|
|
||
| // TheSuperHackers @bugfix arcticdolphin 27/08/2026 Remove destroyed windows from the entire modal stack. | ||
| void GameWindowManager::removeWindowFromModalStack( GameWindow *window ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just preference but this is maybe more readable: void GameWindowManager::removeWindowFromModalStack( GameWindow *window )
{
ModalWindow *previous = nullptr;
ModalWindow *modal = m_modalHead;
while( modal )
{
ModalWindow *next = modal->next;
if( modal->window == window )
{
if( previous )
previous->next = next;
else
m_modalHead = next;
deleteInstance(modal);
}
else
{
previous = modal;
}
modal = next;
}
} |
||
| { | ||
| ModalWindow **link = &m_modalHead; | ||
|
|
||
| while( *link ) | ||
| { | ||
| ModalWindow *modal = *link; | ||
|
|
||
| if( modal->window != window ) | ||
| { | ||
| link = &modal->next; | ||
| continue; | ||
| } | ||
|
|
||
| *link = modal->next; | ||
| deleteInstance(modal); | ||
| } | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| /** Get the grabbed window */ | ||
| //------------------------------------------------------------------------------------------------- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?