0

Currently I'm using fipWinImage to draw image on screen, my code is written in C++(as following).

fipWinImage* m_ClientColorImg;

.....

float width = m_ClientColorImg->getWidth();

The initialization of m_ClientColorImg is not listed here. Sometimes accessing error would occur when I use getWidth() function, but I found that the pointer of this fipWinImage object is normal, not NULL or any corrupted pointers. Does anyone know how to check the fipWinImage object to ensure there is data in it? Or could someone figure out the reason of the error probably?

nikolas
  • 8,707
  • 9
  • 50
  • 70
  • What error do you get? What do you mean the "object is normal, not [...] any corrupted pointers"? Does not corrupted mean that it does point to a properly constructed object of `fipWinImage`? – nikolas Jul 29 '13 at 06:52
  • It seems m_ClientColorImg points to a properly constructed object, but the accessing via getWidth() function is not successful. Have you ever met this kind of error? – shawnlin Jul 29 '13 at 07:11
  • Show us how you initialize `m_ClientColorImg`. By the way, it's good practice to initialize pointers at declaration, e.g. `fipWinImage * m_ClientColorImg = NULL` or `nullptr` in C++11 – nikolas Jul 29 '13 at 07:15
  • I put two CPictureControl tools into one CDialog, each binds with a fipWinImage object. In the construction function of the Dialog, I use the same expression as you list to initialize them. These two fipwinImage objects would be filled with data separately and call refresh function to redraw. Before that, it will call clear function e.g. m_ClientColorImg->clear() to clear data. So I guess when one of the fipWinImage objects call refresh function and redraw, the other one maybe call clear function at the same time. Then the accessing error occurs. @nijansen – shawnlin Jul 29 '13 at 07:41

0 Answers0