Skip to content

Commit

Permalink
Merge pull request #32 from MartinKuschnik/31-exception-thrown-in-des…
Browse files Browse the repository at this point in the history
…tructors-causing-program-crash

adjusted ~IUnknown to do not throw any exception
  • Loading branch information
MartinKuschnik authored Aug 26, 2024
2 parents 002c1be + 22b257a commit 9fc5129
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions WmiLight.Native/WmiLight.Native.rc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 6,5,0,0
PRODUCTVERSION 6,5,0,0
FILEVERSION 6,5,1,0
PRODUCTVERSION 6,5,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -61,12 +61,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Martin Kuschnik"
VALUE "FileDescription", "The native part of the WmiLight lib."
VALUE "FileVersion", "6.5.0.0"
VALUE "FileVersion", "6.5.1.0"
VALUE "InternalName", "WmiLight.Native"
VALUE "LegalCopyright", "Copyright 2024 Martin Kuschnik"
VALUE "OriginalFilename", "WmiLight.Native.dll"
VALUE "ProductName", "WmiLight"
VALUE "ProductVersion", "6.5.0.0"
VALUE "ProductVersion", "6.5.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
6 changes: 2 additions & 4 deletions WmiLight/Wbem/IUnknown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ internal IUnknown(IntPtr nativePointer)

~IUnknown()
{
HResult hResult = NativeMethods.ReleaseIUnknown(this.nativePointer);

if (hResult.Failed)
throw (Exception)hResult;
// do not throw any exception in destructor
NativeMethods.ReleaseIUnknown(this.nativePointer);
}

public static implicit operator IntPtr(IUnknown iUnknown) => iUnknown.nativePointer;
Expand Down
2 changes: 1 addition & 1 deletion WmiLight/WmiLight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</Target>
<PropertyGroup />
<PropertyGroup>
<Version>6.5.0</Version>
<Version>6.5.1</Version>
<PackageId>WmiLight</PackageId>
<Authors>Martin Kuschnik</Authors>
<Company>Martin Kuschnik</Company>
Expand Down

0 comments on commit 9fc5129

Please sign in to comment.