mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
fix: overlay function queue keep growing cause memory leak in electron (#1659)
This commit is contained in:
@@ -25,6 +25,7 @@ namespace VRCX
|
||||
private readonly List<string[]> _deviceList;
|
||||
private readonly ReaderWriterLockSlim _deviceListLock;
|
||||
private bool _active;
|
||||
private bool _isOverlayStarted;
|
||||
private bool _menuButton;
|
||||
private int _overlayHand;
|
||||
private GLTextureWriter _overlayTextureWriter;
|
||||
@@ -213,6 +214,7 @@ namespace VRCX
|
||||
|
||||
active = true;
|
||||
SetupTextures();
|
||||
_isOverlayStarted = true;
|
||||
}
|
||||
|
||||
while (system.PollNextEvent(ref e, (uint)Marshal.SizeOf(e)))
|
||||
@@ -220,6 +222,7 @@ namespace VRCX
|
||||
var type = (EVREventType)e.eventType;
|
||||
if (type == EVREventType.VREvent_Quit)
|
||||
{
|
||||
_isOverlayStarted = false;
|
||||
active = false;
|
||||
IsHmdAfk = false;
|
||||
OpenVR.Shutdown();
|
||||
@@ -290,6 +293,7 @@ namespace VRCX
|
||||
else if (active)
|
||||
{
|
||||
active = false;
|
||||
_isOverlayStarted = false;
|
||||
IsHmdAfk = false;
|
||||
OpenVR.Shutdown();
|
||||
_deviceListLock.EnterWriteLock();
|
||||
@@ -848,9 +852,11 @@ namespace VRCX
|
||||
|
||||
public override void ExecuteVrOverlayFunction(string function, string json)
|
||||
{
|
||||
//if (_hmdOverlaySocket == null || !_hmdOverlaySocket.Connected) return;
|
||||
// if (_hmdOverlay.IsLoading)
|
||||
// Restart();
|
||||
if (!_isOverlayStarted)
|
||||
{
|
||||
_overlayFunctionQueue.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
_overlayFunctionQueue.Enqueue(new KeyValuePair<string, string>(function, json));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user