fix release+refresh hardware caches

This commit is contained in:
deepend committed 2026-12-04 18:24:57 -06:00
1 parent 3abcb33d4f
commit 42efb59ee0
6 files changed
+82 -30

No files matched your search

+26 -12
View File
@@ -49,11 +49,25 @@ typedef struct
char *sound;
} WinStaticSnapshot;
/* Sysinfo callbacks and plugin teardown run on the client thread. */
static WinStaticSnapshot snapshot;
static gsize os_initialized = 0;
static gsize cpu_initialized = 0;
static gsize gpu_initialized = 0;
static gsize sound_initialized = 0;
static gboolean os_initialized;
static gboolean cpu_initialized;
static gboolean gpu_initialized;
static gboolean sound_initialized;
void
sysinfo_backend_reset_cache (void)
{
g_clear_pointer (&snapshot.os, g_free);
g_clear_pointer (&snapshot.cpu, g_free);
g_clear_pointer (&snapshot.gpu, g_free);
g_clear_pointer (&snapshot.sound, g_free);
os_initialized = FALSE;
cpu_initialized = FALSE;
gpu_initialized = FALSE;
sound_initialized = FALSE;
}
static char *wide_to_utf8 (const WCHAR *value);
static char *read_registry_string (HKEY root, const WCHAR *subkey, const WCHAR *value_name);
@@ -444,40 +458,40 @@ build_sound_string (void)
static void
ensure_os_snapshot (void)
{
if (g_once_init_enter (&os_initialized))
if (!os_initialized)
{
snapshot.os = build_os_string ();
g_once_init_leave (&os_initialized, 1);
os_initialized = TRUE;
}
}
static void
ensure_cpu_snapshot (void)
{
if (g_once_init_enter (&cpu_initialized))
if (!cpu_initialized)
{
snapshot.cpu = build_cpu_string ();
g_once_init_leave (&cpu_initialized, 1);
cpu_initialized = TRUE;
}
}
static void
ensure_gpu_snapshot (void)
{
if (g_once_init_enter (&gpu_initialized))
if (!gpu_initialized)
{
snapshot.gpu = build_gpu_string ();
g_once_init_leave (&gpu_initialized, 1);
gpu_initialized = TRUE;
}
}
static void
ensure_sound_snapshot (void)
{
if (g_once_init_enter (&sound_initialized))
if (!sound_initialized)
{
snapshot.sound = build_sound_string ();
g_once_init_leave (&sound_initialized, 1);
sound_initialized = TRUE;
}
}