Skip to content

Commit

Permalink
Fixed memory leaks and added Store policy workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
paulober committed Jan 6, 2023
1 parent 80e1158 commit b12edcf
Show file tree
Hide file tree
Showing 14 changed files with 382 additions and 58 deletions.
3 changes: 2 additions & 1 deletion ArcticControl.GPUInterop/ArcticControl.GPUInterop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define _CRTDBG_MAP_ALLOC
#include "pch.h"

#include <stdio.h>
Expand Down Expand Up @@ -634,6 +633,8 @@ ArcticControlGPUInterop::GPUInterop::!GPUInterop()
if (hAPIHandle != nullptr)
{
ctlClose(*hAPIHandle);
free(hAPIHandle);
hAPIHandle = nullptr;
}

CTL_FREE_MEM(hDevices);
Expand Down
2 changes: 2 additions & 0 deletions ArcticControl.GPUInterop/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef PCH_H
#define PCH_H

#define _CRTDBG_MAP_ALLOC

// Fügen Sie hier Header hinzu, die vorkompiliert werden sollen.
#include <windows.h>
#include <crtdbg.h>
Expand Down
6 changes: 4 additions & 2 deletions ArcticControl/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ArcticControl.Activation;
using System.Diagnostics;
using ArcticControl.Activation;
using ArcticControl.Contracts.Services;
using ArcticControl.Core.Contracts.Services;
using ArcticControl.Core.Services;
Expand Down Expand Up @@ -98,7 +99,8 @@ public App()
services.AddSingleton<IFileService, FileService>();
services.AddSingleton<IGamesScannerService, GamesScannerService>();

// Intel Web Api Service
// Intel Services
services.AddSingleton<IIntelGraphicsControlService, IntelGraphicsControlService>();
services.AddSingleton<IWebArcDriversService, WebArcDriversService>();

// Views and ViewModels
Expand Down
19 changes: 19 additions & 0 deletions ArcticControl/Contracts/Services/IIntelGraphicsControlService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using ArcticControlGPUInterop;

namespace ArcticControl.Contracts.Services;
public interface IIntelGraphicsControlService : IDisposable
{
public bool IsInitialized();
public bool SetOverclockWaiver();
public double GetOverclockPowerLimit();
public double GetOverclockTemperatureLimit();
public double GetOverclockGPUVoltageOffset();
public double GetOverclockGPUFrequencyOffset();
public bool SetOverclockPowerLimit(double newPowerLimit);
public bool SetOverclockTemperatureLimit(double newGPUTemperatureLimit);
public bool SetOverclockGPUVoltageOffset(double newGPUVoltageOffset);
public bool SetOverclockGPUFrequencyOffset(double newGPUFrequencyOffset);
public bool InitPowerDomains();
public PowerProperties? GetPowerProperties();
public PowerLimitsCombination? GetPowerLimits();
}
1 change: 0 additions & 1 deletion ArcticControl/Helpers/InstalledDriverHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Diagnostics;
using System.Management;
using ArcticControlGPUInterop;

namespace ArcticControl.Helpers;

Expand Down
1 change: 1 addition & 0 deletions ArcticControl/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
MinWidth="500"
MinHeight="500"
PersistenceId="MainWindow"
Closed="WindowEx_Closed"
mc:Ignorable="d">
<windowex:WindowEx.Backdrop>
<windowex:MicaSystemBackdrop/>
Expand Down
10 changes: 9 additions & 1 deletion ArcticControl/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using ArcticControl.Helpers;
using System.Diagnostics;
using ArcticControl.Contracts.Services;
using ArcticControl.Helpers;

namespace ArcticControl;

Expand All @@ -17,4 +19,10 @@ public MainWindow()
manager.MinWidth = 1200;
manager.MaxWidth = 1600;
}

private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
{
// TODO: direct invoke of dispose() method ; change if WindowsAppSDK calls disposables
App.GetService<IIntelGraphicsControlService>().Dispose();
}
}
1 change: 0 additions & 1 deletion ArcticControl/Services/AppNotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public bool ShowMessage(string message)
public bool ShowWithActionAndProgressBar(string payload, string filePath, string status, string title, double pbValue, string valueStringOverride)
{
var appNotification = new AppNotificationBuilder()
.AddButton(new AppNotificationButton("Install (under dev)").SetInvokeUri(new Uri(string.Concat("file://", filePath))))
.AddButton(new AppNotificationButton("Open in explorer").SetInvokeUri(new Uri(string.Concat("file://", filePath.AsSpan(0, filePath.LastIndexOf("/"))))))
.AddText(payload)
.AddProgressBar(new AppNotificationProgressBar()
Expand Down
Loading

0 comments on commit b12edcf

Please sign in to comment.