This is a basic C++ question. This list is for the QtCreator IDE. What is 'p'? You're using the array version to delete it so I'm guessing it's a basic C-array (why are you using c-arrays in C++?! You have tr1::array, std::vector etc etc).
Without seeing more of your code it's hard to diagnose the issue. But again this is the wrong list. On Tue, Dec 28, 2010 at 4:31 PM, Paul Wellner Bou <[email protected]>wrote: > Hello, > > I experience a strange SIGSEGV debugging my Qt application: I only get > the SIGSEGV while running the code with the "Debug" button. Running it > with the "Run" button is fine. This is reproducable. I tried it a lot of > times, recompiled in between, tried it then with the Qt Creator 2.1 RC > 1, and so on. (Windows XP.) > > For debugging purposes I printed out the address of the (private) > pointer (The SIGSEGV occurs in a destructor, where I try to delete my > pointers allocated in the methods of the class during runtime): > > When running: 0x0 > When debugging: 0xfeeefeee > > Furthermore, I commented out all the code doing something with this > pointer. And the pointer is initialised with 0 in the constructor. Still > the same error, although it should be 0 through the whole runtime. > > Beside the fact, that there is a bug in my code (the constructor is > called twice and it shouldn't), This should not happen, correct? > > The only explanation I can imagine would be that somehow the destructor > is called twice at almost the same time and as running is faster than > debugging, the pointer is set to 0 before the second destructor tries to > delete it. But even introducing a 0 check before deleting it, this happens. > > > // Ctor > Triangles::Triangles() : p(0) > { > } > > // Destructor > Triangles::~Triangles() > { > qDebug() << this->p; > if(this->p != 0) > delete [] this->p; // <-- I get the SIGSEGV in this line > } > > Regards > Paul. > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.qt.nokia.com/mailman/listinfo/qt-creator >
_______________________________________________ Qt-creator mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-creator
