Commit 3fea1a7
committed
frontend: Fix OAuth and dock state save corruption
When the app is quit on macOS, the underlying process is either
triggered by an application-level "Quit" event or by a main window
"close" event.
If the application-level "Quit" event is the trigger, OBSBasic::saveAll
is called twice: First by Qt's session manager (via OBSApp::commitData)
and another time by the main window's close event handled by
OBSBasic::closeWindow.
However if the main window is closed first (and is the first to call
"saveAll") the underlying OAuth data object is destroyed after the data
has been saved. When the second "saveAll" call takes place, it
encounters a "nullptr" for the auth object, which makes "Auth::Save"
effectively remove any OAuth configuration from the settings file
(undoing prior work).
At the other end, if the application quits first, some dock windows
might have been explicitly closed by Qt before the main window is closed
and thus the second call to "saveAll" will overwrite valid browser dock
state data with incomplete data (any dock that has been closed by Qt
before will not be present in that data).
Wrapping the code responsible for saving OAuth and browser dock state
data in a "std::call_once" block should ensure that this data is only
written once and by whoever gets to call "saveAll" first (at which point
state data is still considered "complete").1 parent 151097d commit 3fea1a7
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
| |||
1849 | 1854 | | |
1850 | 1855 | | |
1851 | 1856 | | |
1852 | | - | |
1853 | | - | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
1854 | 1860 | | |
1855 | | - | |
| 1861 | + | |
| 1862 | + | |
1856 | 1863 | | |
1857 | 1864 | | |
1858 | | - | |
1859 | | - | |
1860 | | - | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
1861 | 1868 | | |
| 1869 | + | |
1862 | 1870 | | |
1863 | 1871 | | |
1864 | 1872 | | |
| |||
0 commit comments