great progress on dive site handling

Thiago Macieira thiago at macieira.org
Mon Jun 29 10:58:57 PDT 2015


On Monday 29 June 2015 06:59:55 Dirk Hohndel wrote:
> > >> (gdb) bt
> > >> #0  Marble::StackedTile::pixel (this=0x0, x=36, y=30) at
> > >> /home/mturkia/source/static/test/marble-source/src/lib/marble/StackedT
> > >> ile.cpp:85> > 
> > > Hmm. this=0x0 - that would explain the crash when accessing a member of
> > > this object. But how the heck did you get there?
> > > 
> > >> #1  0x00007ffff654036c in
> > >> Marble::ScanlineTextureMapperContext::pixelValueApprox
> > >> (this=0x7fff748dbd50, lon=<optimized out>, lat=<optimized out>,
> > >> scanLine=0x240b660, n=<optimized out>)> >>
> > >>     at
> > >>/home/mturkia/source/static/test/marble-source/src/lib/marble/ScanlineT
> > >>extureMapperContext.cpp:316

> > Happens to me quite frequently. Once I have working Internet, I'll try
> > to do full build.sh and see if that helps.
> 
> If I take this stack trace at face value it really doesn't make much
> sense. It shouldn't be crashing where it claims to be crashing.
> It "this" in StackedTile::pixel really was NULL it should crash in the
> caller when trying to dereference the member function.
> 
> Thiago, any brilliant insights?

Line 315-316 is:

*scanLine = m_tile->pixel( ( ( iPosXf >> 7 ) + m_vTileStartX ) >> 
m_deltaLevel,
                           ( ( iPosYf >> 7 ) + m_vTileStartY ) >> m_deltaLevel 
);

And frame 0 is StackedTile::pixel, so I conclude that m_tile is NULL and 
StackedTile::pixel is not a virtual function. m_tile had not been used yet in 
this function, so it's possible it was really null.

m_tile is initialised to NULL in the constructor and is only assigned to in 
ScanlineTextureMapperContext::nextTile (both overloads). I also note that 
there are a couple places where m_tile is checked for NULL, but not in others. 
Both cases where m_tile is accessed without checking for null is preceded by a 
call to isOutOfTileRange.

That's all I can tell: I don't know if m_tile is correctly supposed to be NULL 
there and the code should be checking for validity before dereferencing; or if 
it wasn't supposed to be NULL and loading of the tile was required.

-- 
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