chenfeng8742 / duilib

Automatically exported from code.google.com/p/duilib
0 stars 0 forks source link

UIRender.cpp 的 LoadImage(STRINGorID bitmap, LPCTSTR type, DWORD mask) 问题 #79

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
我用的是SVN 304的版本,
其中在 UIRender.cpp的 LoadImage(STRINGorID bitmap, LPCTSTR type, DWORD 
mask) 有个
pData = new BYTE[ dwSize ]; 
经常会在在此处崩溃(new出错了以后,pData为空,然后在 
::ReadFile( hFile, pData, dwSize, &dwRead, NULL 
)就出现异常了),可能是我机器的问题.现在我的解决办法是

//pData = new BYTE[ dwSize ];
try{
   pData = new(std::nothrow) BYTE[ dwSize ];
  }catch(std::bad_alloc& er)
 {
   pData = NULL;
 }
  if(NULL == pData) break;

Original issue reported on code.google.com by imnewt...@gmail.com on 1 May 2013 at 2:54

GoogleCodeExporter commented 9 years ago
new 都出错?

Original comment by yuheng0...@gmail.com on 2 May 2013 at 2:03

GoogleCodeExporter commented 9 years ago
new 
出错应该是很正常的事情吧,个人感觉至少应该判断是不是为N
ULL

Original comment by imnewt...@gmail.com on 3 May 2013 at 9:40