_com_util::ConvertStringToBSTR - Access Violation

509 Views Asked by At

I'm invoke COM server's method and randomly get access violation error in the _com_util::ConvertStringToBSTR:

g_quote->RegisterQuote(_bstr_t(pszTicker), _bstr_t(_T("*")));

RegisterQuote signature:

HRESULT __stdcall RegisterQuote(BSTR bstrSymbol, BSTR bstrExch);

More information:

int GetQuotesEx(LPCTSTR pszTicker, int nPeriodicity, int nLastValid, int nSize, struct Quotation* pQuotes, GQEContext* pContext) {
    const RecentInfoMap::const_iterator it = g_mapRecentInfo.find(pszTicker);
    if (it == g_mapRecentInfo.end()) {
        g_quote->RegisterQuote(_bstr_t(pszTicker), _bstr_t("*"));
        return nLastValid + 1;
    }
}

I don't know why this bug happens. I can provide additional info if needed.

UPDATE:

enter image description here

enter image description here

0

There are 0 best solutions below