I've been trying to write a wrapper to aid in win32 development. But for some reason I am getting segfaults when trying to access a class member.
I have 2 classes, cAPP and cWIDGET.
In cAPP I have a dynamic array of cWIDGET classes.
I increment the array like this-
But for some reason when I try to access a private member function from cWIDGET, GetHandle(), it segfaults when trying to access a private member variable, handle (of type HWND if it matters). I have no idea why it is segfaulting. I call another function Flush() before the GetHandle() function and it doesn't segfault when it sets handle to NULL..Code:cWIDGET* tmp; this->nWidgets++; tmp = (cWIDGET*)realloc( this->widgets, sizeof( cWIDGET ) * this->nWidgets ); this->widgets = tmp;
I figured it probably how I'm allocating the memory for the widget array. If not I can post more code, but I still have to narrow down where the problem really is.