Skip to content

Commit

Permalink
Fix bad unsafe cast when unwrapping a COMEmbedding (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle authored Jan 1, 2025
1 parent a5da873 commit 97798e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Support/Sources/COM/COMEmbedding+statics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ extension COMEmbedding {
public static func getImplementer<ABIStruct, Implementer>(
_ this: UnsafeMutablePointer<ABIStruct>, type: Implementer.Type = Implementer.self) -> Implementer? {
do {
_ = try COMInterop(this).queryInterface(uuidof(SWRT_COMEmbedding.self))
let comEmbeddingRefeference = try COMInterop(this).queryInterface(uuidof(SWRT_COMEmbedding.self))
// Use the resulting pointer and not "this" since in COM aggregation cases,
// "this" might be a non-Swift COM object.
return getImplementerUnsafe(comEmbeddingRefeference.pointer, type: type)
} catch {
return nil
}

return getImplementerUnsafe(this, type: type)
}
}

Expand Down

0 comments on commit 97798e1

Please sign in to comment.