diff --git a/Support/Sources/COM/COMDelegatingTearOff.swift b/Support/Sources/COM/COMDelegatingTearOff.swift index ce73ab2..327313f 100644 --- a/Support/Sources/COM/COMDelegatingTearOff.swift +++ b/Support/Sources/COM/COMDelegatingTearOff.swift @@ -4,7 +4,7 @@ import COM_ABI public final class COMDelegatingTearOff: COMEmbedderEx { private var comEmbedding: COMEmbedding - public init(virtualTable: UnsafeRawPointer, owner: IUnknown) { + public init(owner: IUnknown, virtualTable: UnsafeRawPointer) { comEmbedding = .init(virtualTable: virtualTable, owner: nil) super.init(implementer: owner) comEmbedding.initOwner(self) diff --git a/Support/Sources/COM/COMExportBase.swift b/Support/Sources/COM/COMExportBase.swift index 20662a2..b007680 100644 --- a/Support/Sources/COM/COMExportBase.swift +++ b/Support/Sources/COM/COMExportBase.swift @@ -24,12 +24,12 @@ open class COMExportBase: IUnknownPro case IAgileObjectBinding.interfaceID where Self.implementIAgileObject: return toCOM().cast() case FreeThreadedMarshalBinding.interfaceID where Self.implementFreeThreadedMarshaling: - return try FreeThreadedMarshal(self).toCOM().cast() + return try FreeThreadedMarshal(owner: self).toCOM().cast() case ISupportErrorInfoBinding.interfaceID where Self.implementISupportErrorInfo: - return try SupportErrorInfoForAllInterfaces(self).toCOM().cast() + return try SupportErrorInfoForAllInterfaces(owner: self).toCOM().cast() default: if let interfaceBinding = Self.queriableInterfaces.first(where: { $0.interfaceID == id }) { - return COMDelegatingTearOff(virtualTable: interfaceBinding.virtualTablePointer, owner: self).toCOM() + return COMDelegatingTearOff(owner: self, virtualTable: interfaceBinding.virtualTablePointer).toCOM() } throw COMError.noInterface } diff --git a/Support/Sources/COM/FreeThreadedMarshal.swift b/Support/Sources/COM/FreeThreadedMarshal.swift index 29d092e..2f9c7a1 100644 --- a/Support/Sources/COM/FreeThreadedMarshal.swift +++ b/Support/Sources/COM/FreeThreadedMarshal.swift @@ -4,7 +4,7 @@ import COM_ABI public final class FreeThreadedMarshal: COMTearOffBase { private let marshaler: COMReference - public init(_ owner: IUnknown) throws { + public init(owner: IUnknown) throws { var marshalerUnknown: IUnknownPointer? = nil try COMError.fromABI(SWRT_CoCreateFreeThreadedMarshaler(/* pUnkOuter: */ nil, &marshalerUnknown)) guard let marshalerUnknown else { throw COMError.noInterface } diff --git a/Support/Sources/WindowsRuntime/ComposableClass.swift b/Support/Sources/WindowsRuntime/ComposableClass.swift index 317aa58..e8b41dc 100644 --- a/Support/Sources/WindowsRuntime/ComposableClass.swift +++ b/Support/Sources/WindowsRuntime/ComposableClass.swift @@ -111,7 +111,7 @@ open class ComposableClass: IInspectableProtocol { // Check for additional implemented interfaces. if let interfaceBinding = type(of: owner).queriableInterfaces.first(where: { $0.interfaceID == id }) { - return COMDelegatingTearOff(virtualTable: interfaceBinding.virtualTablePointer, owner: owner).toCOM() + return COMDelegatingTearOff(owner: owner, virtualTable: interfaceBinding.virtualTablePointer).toCOM() } return try owner._queryInnerInterface(id) diff --git a/Support/Sources/WindowsRuntime/ExportedDelegate.swift b/Support/Sources/WindowsRuntime/ExportedDelegate.swift index 6e32d80..d08408c 100644 --- a/Support/Sources/WindowsRuntime/ExportedDelegate.swift +++ b/Support/Sources/WindowsRuntime/ExportedDelegate.swift @@ -20,7 +20,9 @@ public final class ExportedDelegate: COMEmbedderEx, IU case Binding.interfaceID, IUnknownBinding.interfaceID, IAgileObjectBinding.interfaceID: return toCOM().cast() case FreeThreadedMarshalBinding.interfaceID: - return try FreeThreadedMarshal(self).toCOM().cast() + return try FreeThreadedMarshal(owner: self).toCOM().cast() + case ISupportErrorInfoBinding.interfaceID: + return try SupportErrorInfoForAllInterfaces(owner: self).toCOM().cast() default: throw COMError.noInterface }