mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/gtk-ng: avoid reading corrupt memory in event loop
This commit is contained in:
@ -361,11 +361,15 @@ pub const Application = extern struct {
|
|||||||
//
|
//
|
||||||
// https://gitlab.gnome.org/GNOME/glib/-/blob/bd2ccc2f69ecfd78ca3f34ab59e42e2b462bad65/gio/gapplication.c#L2302
|
// https://gitlab.gnome.org/GNOME/glib/-/blob/bd2ccc2f69ecfd78ca3f34ab59e42e2b462bad65/gio/gapplication.c#L2302
|
||||||
const priv = self.private();
|
const priv = self.private();
|
||||||
const config = priv.config.get();
|
{
|
||||||
if (config.@"initial-window") switch (config.@"launched-from".?) {
|
// We need to scope any config access because once we run our
|
||||||
.desktop, .cli => self.as(gio.Application).activate(),
|
// event loop, this can change out from underneath us.
|
||||||
.dbus, .systemd => {},
|
const config = priv.config.get();
|
||||||
};
|
if (config.@"initial-window") switch (config.@"launched-from".?) {
|
||||||
|
.desktop, .cli => self.as(gio.Application).activate(),
|
||||||
|
.dbus, .systemd => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// If we are NOT the primary instance, then we never want to run.
|
// If we are NOT the primary instance, then we never want to run.
|
||||||
// This means that another instance of the GTK app is running and
|
// This means that another instance of the GTK app is running and
|
||||||
@ -393,6 +397,7 @@ pub const Application = extern struct {
|
|||||||
// Check if we must quit based on the current state.
|
// Check if we must quit based on the current state.
|
||||||
const must_quit = q: {
|
const must_quit = q: {
|
||||||
// If we are configured to always stay running, don't quit.
|
// If we are configured to always stay running, don't quit.
|
||||||
|
const config = priv.config.get();
|
||||||
if (!config.@"quit-after-last-window-closed") break :q false;
|
if (!config.@"quit-after-last-window-closed") break :q false;
|
||||||
|
|
||||||
// If the quit timer has expired, quit.
|
// If the quit timer has expired, quit.
|
||||||
|
Reference in New Issue
Block a user