latest master

Thiago Macieira thiago at macieira.org
Tue Feb 18 16:47:36 UTC 2014


Em ter 18 fev 2014, às 16:30:01, Dirk Hohndel escreveu:
> > Can someone verify whether the pointer was null? It looks unlikely though.
> 
> Definitely not null. And adding qDebug() to the lastUsedImageDir()
> function I was able to see that it got called. But something in that
> process destroyed the MainWindow object. Specifically, returning from
> that function appeared to cause bad things to happen inside the
> MainWindow object. And Valgrind didn't find ANYTHING.
> 
> I can easily reproduce the situation if you want to poke at it on a life
> machine :-)

I could reproduce on mine.

Actually, my bullet grazed the skull of the bug here. dive_list() did not 
return NULL, but it did become null after that line.

Here's why:
	MainWindow().dive_list()->lastUsedImageDir(),

That should have been:
	MainWindow::instance().dive_list()

That MainWindow() there creates a new main window temporary, which overwrites 
m_Instance. At the end of that line (at the ;), the temporary gets destroyed 
and sets m_Instance to null.

So the next MainWindow::instance() call returns null.

So Robert's patch fixes the issue. It's correct. In addition to that, please 
apply my patch that adds an assertion to prevent this problem from happening 
again.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list