mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +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 List<string[]> _deviceList;
|
||||||
private readonly ReaderWriterLockSlim _deviceListLock;
|
private readonly ReaderWriterLockSlim _deviceListLock;
|
||||||
private bool _active;
|
private bool _active;
|
||||||
|
private bool _isOverlayStarted;
|
||||||
private bool _menuButton;
|
private bool _menuButton;
|
||||||
private int _overlayHand;
|
private int _overlayHand;
|
||||||
private GLTextureWriter _overlayTextureWriter;
|
private GLTextureWriter _overlayTextureWriter;
|
||||||
@@ -213,6 +214,7 @@ namespace VRCX
|
|||||||
|
|
||||||
active = true;
|
active = true;
|
||||||
SetupTextures();
|
SetupTextures();
|
||||||
|
_isOverlayStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (system.PollNextEvent(ref e, (uint)Marshal.SizeOf(e)))
|
while (system.PollNextEvent(ref e, (uint)Marshal.SizeOf(e)))
|
||||||
@@ -220,6 +222,7 @@ namespace VRCX
|
|||||||
var type = (EVREventType)e.eventType;
|
var type = (EVREventType)e.eventType;
|
||||||
if (type == EVREventType.VREvent_Quit)
|
if (type == EVREventType.VREvent_Quit)
|
||||||
{
|
{
|
||||||
|
_isOverlayStarted = false;
|
||||||
active = false;
|
active = false;
|
||||||
IsHmdAfk = false;
|
IsHmdAfk = false;
|
||||||
OpenVR.Shutdown();
|
OpenVR.Shutdown();
|
||||||
@@ -290,6 +293,7 @@ namespace VRCX
|
|||||||
else if (active)
|
else if (active)
|
||||||
{
|
{
|
||||||
active = false;
|
active = false;
|
||||||
|
_isOverlayStarted = false;
|
||||||
IsHmdAfk = false;
|
IsHmdAfk = false;
|
||||||
OpenVR.Shutdown();
|
OpenVR.Shutdown();
|
||||||
_deviceListLock.EnterWriteLock();
|
_deviceListLock.EnterWriteLock();
|
||||||
@@ -848,9 +852,11 @@ namespace VRCX
|
|||||||
|
|
||||||
public override void ExecuteVrOverlayFunction(string function, string json)
|
public override void ExecuteVrOverlayFunction(string function, string json)
|
||||||
{
|
{
|
||||||
//if (_hmdOverlaySocket == null || !_hmdOverlaySocket.Connected) return;
|
if (!_isOverlayStarted)
|
||||||
// if (_hmdOverlay.IsLoading)
|
{
|
||||||
// Restart();
|
_overlayFunctionQueue.Clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_overlayFunctionQueue.Enqueue(new KeyValuePair<string, string>(function, json));
|
_overlayFunctionQueue.Enqueue(new KeyValuePair<string, string>(function, json));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user