[Marble-devel] Review Request: More robust tile loading

Bernhard Beschow bbeschow at cs.tu-berlin.de
Fri Jun 25 17:19:38 CEST 2010



> On 2010-06-25 13:05:44, jmho wrote:
> > trunk/KDE/kdeedu/marble/src/lib/TileLoader.cpp, line 207
> > <http://reviewboard.kde.org/r/4444/diff/2/?file=29757#file29757line207>
> >
> >     This now returns a copy. Is this really necessary? Could we not try to not copy QImages at all?
> 
> Torsten Rahn wrote:
>     Does it create a deep copy or a shallow copy? Where does the detach happen? :-)
> 
> Bernhard Beschow wrote:
>     As explained above, copying a QImage is very fast. Why not use the convenience that QImage provides?
> 
> Bernhard Beschow wrote:
>     @Torsten: It creates a shallow copy. The detach happens when TextureTile::setImage() is called.
> 
> Torsten Rahn wrote:
>     @Bernhard: Huh? Why should TextureTile::setImage() create a detach? 
>     
>     inline void TextureTile::setImage( QImage const &image )
>     {
>         Q_ASSERT( !image.isNull() );
>     
>         m_image = image;
>     }
>     
>     I don't see a detach happening there.
>
> 
> Bernhard Beschow wrote:
>     @Torsten: It must detach from the old data m_image is attached to before the assignment.
> 
> Torsten Rahn wrote:
>     Bernhard: No. In this case there's just an assignment happening. That only involves reference count changes but no deep copy. Since the reference count would be > 1 afterwards this would prepare for a possible detach that would happen if the m_image would get modified at a later point. But that would only happen inside a different method way after the execution of setImage() is finished.

Torsten: Convinced :)


- Bernhard


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4444/#review6274
-----------------------------------------------------------


On 2010-06-25 12:49:24, Bernhard Beschow wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4444/
> -----------------------------------------------------------
> 
> (Updated 2010-06-25 12:49:24)
> 
> 
> Review request for marble.
> 
> 
> Summary
> -------
> 
> Motivation: It may happen that Marble receives invalid image data over the network or loads invalid image data from disk, making Marble really slow. This is caused by heavy debug output from QImage while Marble tries to access invalid image data. This will be qFatal in the upcoming Qt 4.7.
> 
> Solution: Check if the image is valid ater loading data into a QImage instead of blindly loading data into it. Also Q_ASSERT every image assignment in TextureTile.
> 
> Note that by this patch, Marble will abort when TileLoader::scaledLowerLevelTile() is not able to produce a scaled image. This could happen when the level-zero tile is missing.
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdeedu/marble/src/lib/TextureTile.h 1142673 
>   trunk/KDE/kdeedu/marble/src/lib/TextureTile.cpp 1142673 
>   trunk/KDE/kdeedu/marble/src/lib/TileLoader.h 1142673 
>   trunk/KDE/kdeedu/marble/src/lib/TileLoader.cpp 1142673 
> 
> Diff: http://reviewboard.kde.org/r/4444/diff
> 
> 
> Testing
> -------
> 
> Works for me. Please test if it works for you as well!
> 
> 
> Thanks,
> 
> Bernhard
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/marble-devel/attachments/20100625/36421fef/attachment.htm 


More information about the Marble-devel mailing list