C++ code throwing Seg. Fault -
i have c++ code follow:
tryit.h file
class tryit : public someotherclass { public: bool inserti (); private: commandi* m_pinserti; bool createinserti(); }
tryit.cpp file
tryit ::tryit () : m_pinserti(null) { createinserti(); } tryit ::~tryit () { if(m_pinserti!=null) { delete m_pinserti; m_pinserti=null } } bool createinserti() { m_pinserti = returnfromsomeotherfunction(); return true; } bool inserti() { // on here if use m_pinserti anyhow code fails seg fault // checking if(m_pinserti==null) make code throw seg fault }
so issue touching m_pinserti anywhere make code throw seg. fault (signal 11). debugged code gdb didn't got useful info.
compiler gcc
please help.
sounds instance of class not exist or damaged. why can't access of members , if(m_pinserti==null) check raises exception.
Comments
Post a Comment