Commit Graph

11 Commits

Author SHA1 Message Date
PatTheMav
921dc93927 frontend: Fix macOS crash in application shutdown
With recent changes to the application shutdown logic, events had to
follow a very strict order as certain elements of shutdown code
depend on other elements not being deallocated prematurely.

This turned the (correct) order of events on macOS upside down and
lead to crashes either when the app was quit from within or when
terminated by the OS.

The fix incorporates multiple elements:

* Removal of the custom "Quit" menu item on macOS to use the default
  implementation of Qt's platform plugin.
* Soft-revert (via preprocessor conditionals) parts of the updated
  shutdown logic to prevent emitting recursive shutdown events.
* Handle main window close event by simply emitting a "quit" event
  on the application instance.
* Update POSIX signal handlers to also simply emit a "quit" event.

In combination these changes reduce the number of different code paths
taken during shutdown:

* Closing the app via the menu item, menu item shortcut, or initiated
  by AppKit (OS shutdown/reboot, or quit via Dock/Finder) will emit an
  AppKit "terminate" event for orderly shutdown.
* Closing the main window or sending an appropriate POSIX signal
  triggers the "terminate" event indirectly by emitting the "quit"
  event on the application instance.

Either way a "close" event to the main window happens before the
event loop is terminated and the application instance is torn down
(either directly, or indirectly via Qt's "closeAllWindows" function in
response to "terminate"). The order of events thus is always:

0. Terminate event by AppKit (except when closing the main window)
1. Closing of main window
2. Termination of browser docks
3. Deallocation of main window
4. Termination of application
5. Deallocation of application

NOTE: All this only applies to macOS. The shutdown order and procedures
on Windows and Linux are unchanged.
2026-02-04 17:04:31 -05:00
Anton Kesy
22016f309c frontend: Fix typos 2026-01-14 13:47:30 -05:00
Warchamp7
a42a6c4c5f frontend: Refactor and update Audio Mixer 2026-01-13 16:34:33 -05:00
Warchamp7
14572498dc frontend: Adjust application shutdown logic
Improves app shutdown in a few ways, including separating out different
pieces of the OBSBasic close handler into their own functions.

Removes the crash handler sentinel earlier when the main window is closed,
preventing unclean shutdown warnings when a plugin causes issues. While not
ideal, the dialog is not useful when we cannot specify which plugin caused the
problem.

Increases shutdown priority of the main application so that when OBS interrupts
the session ending, CEF is not closed at the same time. This fixes a crash.

Additional safeguards and event handling to try to ensure a smoother shutdown.
2025-12-01 16:40:34 -05:00
Joel Bethke
c4cccf7b7e frontend: Remove help text for shutdown check 2025-09-16 18:02:25 -04:00
cg2121
4b403d2a3e frontend: Use signal to update log viewer
Instead of calling the log viewer directly, use a signal instead.
2025-08-23 12:13:39 -04:00
PatTheMav
de997b1e2f frontend: Update crash handling and log upload functionality
Updates include:

* Use of CrashHandler to provide automatic uploads of the most recent
crash log if an unclean shutdown was detected and it has not been
uploaded yet.
* Detection and handling of unclean shutdowns is delegated entirely to
the CrashHandler class
* Use of OBSLogReply has been replaced with the LogUploadDialog, which
asks for confirmation before new uploads of log files (confirmation is
skipped for files with available upload URLs already - only available
for crash logs with this change)

Architectural changes:
* OBSApp is the layer responsible for application launch and shutdown
states, as well as crash logs and application logs
* The actual handling is delegated to purpose-made classes which OBSApp
owns instances of
* OBSBasic in turn refers to OBSApp for all this functionality, and can
subscribe/connect to appropriate events exposed by OBSApp to this
purpose
* Implementation details (like the existence of the CrashHandler class)
are not exposed to OBSBasic or the LogUploadDialog

The amount of changes for normal log file upload have been purposefully
limited. A proper refactoring of the application log file handling will
move this code out of OBSBasic as well.
2025-08-22 15:38:12 -04:00
Matt Gajownik
5b87ced7cd frontend: Increase MAX_CRASH_REPORT_SIZE to 200 KB
With CEF and NDI, logs can exceed 150KB, cutting off symbol addresses.
2025-04-15 12:33:42 -07:00
gxalpha
a562b8bf52 frontend: Add Input Monitoring to permissions dialog
The previous commit switched global hotkeys from requiring Accessibility
to just Input Monitoring permissions. This adds the matching changes to
the permissions dialog, also accounting for the fact that Accessibility
includes Input Monitoring.
2025-02-05 14:33:06 -05:00
PatTheMav
2be464a21f frontend: Split main application implementation into single files 2025-01-08 17:33:13 +01:00
PatTheMav
bcc6880183 frontend: Prepare main application implementation for splits 2025-01-08 17:33:13 +01:00