great progress on dive site handling

Dirk Hohndel dirk at hohndel.org
Mon Jun 29 11:07:08 PDT 2015


On Mon, Jun 29, 2015 at 10:58:57AM -0700, Thiago Macieira wrote:
> 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.

I have no idea, either.
Thanks Thiago for taking a look. It confused me that this would thrown a
SIGSEGV in the pixel() function and not when dereferencing m_title to get
to the pixel member function...

Miika, I pushed a change to our Marble branch that only tries to call
pixel() if m_tile is not NULL. Let's see if that fixes your crash.

/D


More information about the subsurface mailing list