Fixed CTD in patchAdapterids

Error with PatchAdapterIds that caused a crash to desktop. Has now been fixed. Should fix #117 and #118
This commit is contained in:
Terry MacDonald 2022-06-09 22:25:37 +12:00
parent 05e0fa647e
commit 97d9caf2af
3 changed files with 13 additions and 7 deletions

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.4.0.12")]
[assembly: AssemblyFileVersion("2.4.0.12")]
[assembly: AssemblyVersion("2.4.0.20")]
[assembly: AssemblyFileVersion("2.4.0.20")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]

View File

@ -2494,7 +2494,8 @@ namespace DisplayMagicianShared.NVIDIA
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: Some non standard error occurred while getting Mosaic Topology! NvAPI_Mosaic_EnableCurrentTopo() returned error code {NVStatus}");
}*/
NV_MOSAIC_SETDISPLAYTOPO_FLAGS setTopoFlags = NV_MOSAIC_SETDISPLAYTOPO_FLAGS.MAXIMIZE_PERFORMANCE;
//NV_MOSAIC_SETDISPLAYTOPO_FLAGS setTopoFlags = NV_MOSAIC_SETDISPLAYTOPO_FLAGS.MAXIMIZE_PERFORMANCE;
NV_MOSAIC_SETDISPLAYTOPO_FLAGS setTopoFlags = NV_MOSAIC_SETDISPLAYTOPO_FLAGS.NONE;
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: Mosaic current config is different as the one we want, so applying the Mosaic config now");
// If we get here then the display is valid, so now we actually apply the new Mosaic Topology

View File

@ -302,10 +302,15 @@ namespace DisplayMagicianShared.Windows
{
// We get here if there is a matching adapter
newAdapterValue = adapterOldToNewMap[oldAdapterValue];
// Add a new dictionary key with the old value
savedDisplayConfig.DisplayAdapters.Add(newAdapterValue, savedDisplayConfig.DisplayAdapters[oldAdapterValue]);
// Remove the old dictionary key
savedDisplayConfig.DisplayAdapters.Remove(oldAdapterValue);
// Skip if we've already replaced something!
if (!savedDisplayConfig.DisplayAdapters.ContainsKey(newAdapterValue))
{
// Add a new dictionary key with the old value
savedDisplayConfig.DisplayAdapters.Add(newAdapterValue, savedDisplayConfig.DisplayAdapters[oldAdapterValue]);
// Remove the old dictionary key
savedDisplayConfig.DisplayAdapters.Remove(oldAdapterValue);
}
SharedLogger.logger.Trace($"WinLibrary/PatchAdapterIDs: Updated DisplayAdapter from adapter {oldAdapterValue} to adapter {newAdapterValue} instead.");
}
}