From 8a7627ae85fdfd345781595c62b38d650fc52565 Mon Sep 17 00:00:00 2001 From: Sebastian Alex Date: Tue, 17 Dec 2024 11:41:08 +0100 Subject: [PATCH] electron: fix potential loop with gpu-info-update --- .../electron/src/main/attributes/GpuAttributeProvider.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/electron/src/main/attributes/GpuAttributeProvider.ts b/packages/electron/src/main/attributes/GpuAttributeProvider.ts index 61009ffa..b0afe389 100644 --- a/packages/electron/src/main/attributes/GpuAttributeProvider.ts +++ b/packages/electron/src/main/attributes/GpuAttributeProvider.ts @@ -49,11 +49,16 @@ export class GpuAttributeProvider implements BacktraceAttributeProvider { private _attributes?: Record; constructor() { + // getGPUInfo may not be supported on earlier versions of Electron if (!app.getGPUInfo) { return; } - app.on('gpu-info-update', () => + // Collect this information only once + // getGPUInfo causes 'gpu-info-update' to be emitted again essentially causing a loop + // https://github.com/electron/electron/issues/30827 + // It is unlikely to change again within runtime of the application + app.once('gpu-info-update', () => app .getGPUInfo('complete') .then((info) => {