Fix Exception issue for shared resources

Change-Id: I65b4f1b0ae29e736ba3669b097feff2ae5516303
Signed-off-by: drprajap <dimpalben.r.prajapati@intel.com>
This commit is contained in:
shankarp 2018-09-10 12:31:23 -07:00 committed by gbsbuild
parent fe0fc5afe8
commit 3bbe741763
2 changed files with 17 additions and 3 deletions

View File

@ -333,10 +333,17 @@ ERROR_CASE:
GMM_RESOURCE_INFO *GMM_STDCALL GmmLib::GmmClientContext::CopyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) GMM_RESOURCE_INFO *GMM_STDCALL GmmLib::GmmClientContext::CopyResInfoObject(GMM_RESOURCE_INFO *pSrcRes)
{ {
GMM_RESOURCE_INFO *pResCopy = NULL; GMM_RESOURCE_INFO *pResCopy = NULL;
GmmClientContext * pClientContextIn = NULL;
#if(!defined(GMM_UNIFIED_LIB))
pClientContextIn = pGmmGlobalContext->pGmmGlobalClientContext;
#else
pClientContextIn = this;
#endif
__GMM_ASSERTPTR(pSrcRes, NULL); __GMM_ASSERTPTR(pSrcRes, NULL);
pResCopy = new GMM_RESOURCE_INFO; pResCopy = new GMM_RESOURCE_INFO(pClientContextIn);
if(!pResCopy) if(!pResCopy)
{ {
GMM_ASSERTDPF(0, "Allocation failed."); GMM_ASSERTDPF(0, "Allocation failed.");
@ -361,9 +368,17 @@ GMM_RESOURCE_INFO *GMM_STDCALL GmmLib::GmmClientContext::CopyResInfoObject(GMM_R
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmLib::GmmClientContext::ResMemcpy(void *pDst, void *pSrc) void GMM_STDCALL GmmLib::GmmClientContext::ResMemcpy(void *pDst, void *pSrc)
{ {
GmmClientContext *pClientContextIn = NULL;
#if(!defined(GMM_UNIFIED_LIB))
pClientContextIn = pGmmGlobalContext->pGmmGlobalClientContext;
#else
pClientContextIn = this;
#endif
GMM_RESOURCE_INFO *pResSrc = reinterpret_cast<GMM_RESOURCE_INFO *>(pSrc); GMM_RESOURCE_INFO *pResSrc = reinterpret_cast<GMM_RESOURCE_INFO *>(pSrc);
// Init memory correctly, in case the pointer is a raw memory pointer // Init memory correctly, in case the pointer is a raw memory pointer
GMM_RESOURCE_INFO *pResDst = new(pDst) GMM_RESOURCE_INFO(); GMM_RESOURCE_INFO *pResDst = new(pDst) GMM_RESOURCE_INFO(pClientContextIn);
*pResDst = *pResSrc; *pResDst = *pResSrc;
} }

View File

@ -174,7 +174,6 @@ namespace GmmLib
SvmAddress = rhs.SvmAddress; SvmAddress = rhs.SvmAddress;
pPrivateData = rhs.pPrivateData; pPrivateData = rhs.pPrivateData;
pGmmLibContext = rhs.pGmmLibContext; pGmmLibContext = rhs.pGmmLibContext;
pClientContext = rhs.pClientContext;
return *this; return *this;
} }