mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add null checks and improve dialog window handling
Added early null checks for `hwnd` to prevent invalid processing. Enhanced thread safety by locking `_dialogWindow` updates. Documented dialog window state handling with comments for clarity. Handled scenarios for dialog window movement, resizing, hiding, destruction, and termination. Improved robustness and maintainability.
This commit is contained in:
parent
38c0fae064
commit
5623bf253b
1 changed files with 12 additions and 0 deletions
|
|
@ -496,6 +496,8 @@ namespace Flow.Launcher.Infrastructure.DialogJump
|
|||
uint dwmsEventTime
|
||||
)
|
||||
{
|
||||
if (hwnd.IsNull) return;
|
||||
|
||||
await _foregroundChangeLock.WaitAsync();
|
||||
try
|
||||
{
|
||||
|
|
@ -647,6 +649,8 @@ namespace Flow.Launcher.Infrastructure.DialogJump
|
|||
uint dwmsEventTime
|
||||
)
|
||||
{
|
||||
if (hwnd.IsNull) return;
|
||||
|
||||
// If the dialog window is moved, update the Dialog Jump window position
|
||||
var dialogWindowExist = false;
|
||||
lock (_dialogWindowLock)
|
||||
|
|
@ -672,6 +676,8 @@ namespace Flow.Launcher.Infrastructure.DialogJump
|
|||
uint dwmsEventTime
|
||||
)
|
||||
{
|
||||
if (hwnd.IsNull) return;
|
||||
|
||||
// If the dialog window is moved or resized, update the Dialog Jump window position
|
||||
if (_dragMoveTimer != null)
|
||||
{
|
||||
|
|
@ -697,6 +703,8 @@ namespace Flow.Launcher.Infrastructure.DialogJump
|
|||
uint dwmsEventTime
|
||||
)
|
||||
{
|
||||
if (hwnd.IsNull) return;
|
||||
|
||||
// If the dialog window is destroyed, set _dialogWindowHandle to null
|
||||
var dialogWindowExist = false;
|
||||
lock (_dialogWindowLock)
|
||||
|
|
@ -728,6 +736,8 @@ namespace Flow.Launcher.Infrastructure.DialogJump
|
|||
uint dwmsEventTime
|
||||
)
|
||||
{
|
||||
if (hwnd.IsNull) return;
|
||||
|
||||
// If the dialog window is hidden, set _dialogWindowHandle to null
|
||||
var dialogWindowExist = false;
|
||||
lock (_dialogWindowLock)
|
||||
|
|
@ -759,6 +769,8 @@ namespace Flow.Launcher.Infrastructure.DialogJump
|
|||
uint dwmsEventTime
|
||||
)
|
||||
{
|
||||
if (hwnd.IsNull) return;
|
||||
|
||||
// If the dialog window is ended, set _dialogWindowHandle to null
|
||||
var dialogWindowExist = false;
|
||||
lock (_dialogWindowLock)
|
||||
|
|
|
|||
Loading…
Reference in a new issue