I have a function where I am calling CoCreateInstance. This function is called multiple times and it works, however one time the CoCreateInstance fails with the “Bad variable type” error. The thing is the parameters are always the same both when it succedes and when it fails. What could cause this to happen?
I have a function where I am calling CoCreateInstance. This function is called multiple
Share
I fixed this.
The call was made from different threads. When the call succeded, it was called from the main thread. On fail, a different thread was the source and CoInitialize() wasn’t called beforehand.
Calling CoInitialize solved the problem.