| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Functions
LuaDebuggerMainClosePolicy Namespace Reference

Pause-aware arbitration for main-window close while the Lua debugger is involved. More...

## Functions
bool | handleMainCloseIfPaused (QCloseEvent *event)
| Decide whether to defer a main-window close while the Lua debugger needs to arbitrate.
void | deliverDeferredMainCloseIfPending ()
| Re-deliver a previously deferred main-window close, if any. Idempotent.
void | markQuitRequested ()
| Record a debugger-initiated quit (Ctrl+Q from the debugger window) so that the main window will be closed after the debugger dialog has finished its own close gate.
void | cancelPendingClose ()
| Cancel any pending deferred main close.

## Detailed Description

Pause-aware arbitration for main-window close while the Lua debugger is involved.

The Lua dissector can land Wireshark inside a nested QEventLoop driven by LuaDebuggerPauseController while the C call stack still has `cf_read` / dissection frames above us. Allowing the main window to tear down at that point would run `tryClosingCaptureFile()` and `mainApp->quit()` with the Lua dissector still on the stack and abort in `wmem_cleanup_scopes()` at exit. The main window therefore routes its closeEvent through handleMainCloseIfPaused first; if the debugger needs to arbitrate (paused, or owns unsaved scripts), the close is recorded as pending and the event is rejected. Once the Lua stack has unwound (deliverDeferredMainCloseIfPending called from `handlePause()'s` post-loop cleanup, or from the dialog's own closeEvent when not paused) the close is queued back to the main window via `QMetaObject::invokeMethod(Qt::QueuedConnection)`.

## Function Documentation

## ◆ handleMainCloseIfPaused()

bool LuaDebuggerMainClosePolicy::handleMainCloseIfPaused | ( | QCloseEvent * | event | ) |

Decide whether to defer a main-window close while the Lua debugger needs to arbitrate.

Returns
  `true` if the close has been deferred (the caller MUST treat the event as ignored and return without closing); `false` to let the main window close normally.