Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:11.4:Update
kdeedu4.import4997
marble_crash_zooming_bnc695213.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File marble_crash_zooming_bnc695213.diff of Package kdeedu4.import4997
commit 3a6a1e280532b79299b8b8a3bc17ed87faeaa834 Author: Bernhard Beschow <bbeschow@cs.tu-berlin.de> Date: Thu Apr 14 22:34:28 2011 +0200 ViewParams: use QSharedPointer to hold the canvas and coast images * fixes a crash when the appearance of the download progress bar causes a resize of the map during painting CCBUG: 265599 RevBy: Dennis Nienhüser FIXED-IN: 1.0.4 (cherry picked from commit aa598a3a80233718711699562437e77b4cbee875) diff --git a/src/lib/EquirectScanlineTextureMapper.cpp b/src/lib/EquirectScanlineTextureMapper.cpp index 422b22c..ce60ca1 100644 --- marble/src/lib/EquirectScanlineTextureMapper.cpp +++ marble/src/lib/EquirectScanlineTextureMapper.cpp @@ -64,7 +64,7 @@ void EquirectScanlineTextureMapper::setRepaintNeeded() void EquirectScanlineTextureMapper::mapTexture( ViewParams *viewParams, TextureColorizer *texColorizer ) { - QImage *canvasImage = viewParams->canvasImage(); + QSharedPointer<QImage> canvasImage = viewParams->canvasImagePtr(); const int imageHeight = canvasImage->height(); const int imageWidth = canvasImage->width(); const qint64 radius = viewParams->radius(); diff --git a/src/lib/MercatorScanlineTextureMapper.cpp b/src/lib/MercatorScanlineTextureMapper.cpp index d0d5c8c..eeaba58 100644 --- marble/src/lib/MercatorScanlineTextureMapper.cpp +++ marble/src/lib/MercatorScanlineTextureMapper.cpp @@ -66,7 +66,7 @@ void MercatorScanlineTextureMapper::setRepaintNeeded() void MercatorScanlineTextureMapper::mapTexture( ViewParams *viewParams, TextureColorizer *texColorizer ) { - QImage *canvasImage = viewParams->canvasImage(); + QSharedPointer<QImage> canvasImage = viewParams->canvasImagePtr(); const int imageHeight = canvasImage->height(); const int imageWidth = canvasImage->width(); const qint64 radius = viewParams->radius(); diff --git a/src/lib/PlacemarkLayout.cpp b/src/lib/PlacemarkLayout.cpp index 1b57dca..c486545 100644 --- marble/src/lib/PlacemarkLayout.cpp +++ marble/src/lib/PlacemarkLayout.cpp @@ -188,7 +188,7 @@ void PlacemarkLayout::paintPlaceFolder( QPainter *painter, return; // const int imgwidth = viewParams->canvasImage()->width(); - const int imgheight = viewParams->canvasImage()->height(); + const int imgheight = viewParams->canvasImagePtr()->height(); if ( m_styleResetRequested ) { m_styleResetRequested = false; diff --git a/src/lib/SphericalScanlineTextureMapper.cpp b/src/lib/SphericalScanlineTextureMapper.cpp index ee58679..a575924 100644 --- marble/src/lib/SphericalScanlineTextureMapper.cpp +++ marble/src/lib/SphericalScanlineTextureMapper.cpp @@ -68,7 +68,7 @@ void SphericalScanlineTextureMapper::setRepaintNeeded() void SphericalScanlineTextureMapper::mapTexture( ViewParams *viewParams, TextureColorizer *texColorizer ) { - QImage *canvasImage = viewParams->canvasImage(); + QSharedPointer<QImage> canvasImage = viewParams->canvasImagePtr(); const int imageHeight = canvasImage->height(); const int imageWidth = canvasImage->width(); const qint64 radius = viewParams->radius(); diff --git a/src/lib/TextureColorizer.cpp b/src/lib/TextureColorizer.cpp index 7549c4e..0cf9be5 100644 --- marble/src/lib/TextureColorizer.cpp +++ marble/src/lib/TextureColorizer.cpp @@ -15,6 +15,7 @@ #include <cmath> #include <QtCore/QFile> +#include <QtCore/QSharedPointer> #include <QtCore/QString> #include <QtCore/QTime> #include <QtGui/QColor> @@ -170,8 +171,8 @@ void TextureColorizer::colorize(ViewParams *viewParams) // update coastimg m_veccomposer.drawTextureMap( viewParams ); - QImage *origimg = viewParams->canvasImage(); - const QImage *coastimg = viewParams->coastImage(); + QSharedPointer<QImage> origimg = viewParams->canvasImagePtr(); + QSharedPointer<const QImage> coastimg = viewParams->coastImagePtr(); const qint64 radius = viewParams->radius(); const int imgheight = origimg->height(); diff --git a/src/lib/TileScalingTextureMapper.cpp b/src/lib/TileScalingTextureMapper.cpp index 8477f52..8a69a01 100644 --- marble/src/lib/TileScalingTextureMapper.cpp +++ marble/src/lib/TileScalingTextureMapper.cpp @@ -73,7 +73,7 @@ void TileScalingTextureMapper::mapTexture( GeoPainter *geoPainter, ViewParams *v if ( viewParams->radius() <= 0 ) return; - QImage *canvasImage = viewParams->canvasImage(); + QSharedPointer<QImage> canvasImage = viewParams->canvasImagePtr(); const int imageHeight = canvasImage->height(); const int imageWidth = canvasImage->width(); const qint64 radius = viewParams->radius(); @@ -109,7 +109,7 @@ void TileScalingTextureMapper::mapTexture( GeoPainter *geoPainter, ViewParams *v if ( texColorizer || m_oldRadius != radius ) { m_cache->clear(); - QPainter painter( canvasImage ); + QPainter painter( canvasImage.data() ); painter.setRenderHint( QPainter::SmoothPixmapTransform, highQuality ); for ( int tileY = minTileY; tileY <= maxTileY; ++tileY ) { diff --git a/src/lib/VectorComposer.cpp b/src/lib/VectorComposer.cpp index 26d3dca..68a0367 100644 --- marble/src/lib/VectorComposer.cpp +++ marble/src/lib/VectorComposer.cpp @@ -150,7 +150,7 @@ void VectorComposer::drawTextureMap(ViewParams *viewParams) { loadCoastlines(); - QImage *origimg = viewParams->coastImage(); + QSharedPointer<QImage> origimg = viewParams->coastImagePtr(); Quaternion rotAxis = viewParams->planetAxis(); origimg->fill( Qt::transparent ); @@ -173,7 +173,7 @@ void VectorComposer::drawTextureMap(ViewParams *viewParams) m_vectorMap->createFromPntMap( s_coastLines, viewParams->viewport() ); m_vectorMap->setPen( m_textureLandPen ); m_vectorMap->setBrush( m_textureLandBrush ); - m_vectorMap->drawMap( origimg, antialiased, viewParams->viewport(), + m_vectorMap->drawMap( origimg.data(), antialiased, viewParams->viewport(), viewParams->mapQuality() ); // Islands @@ -183,7 +183,7 @@ void VectorComposer::drawTextureMap(ViewParams *viewParams) m_vectorMap->createFromPntMap( s_islands, viewParams->viewport() ); m_vectorMap->setPen( m_textureLandPen ); m_vectorMap->setBrush( m_textureLandBrush ); - m_vectorMap->drawMap( origimg, antialiased, viewParams->viewport(), + m_vectorMap->drawMap( origimg.data(), antialiased, viewParams->viewport(), viewParams->mapQuality() ); bool showWaterbodies, showLakes; @@ -198,13 +198,13 @@ void VectorComposer::drawTextureMap(ViewParams *viewParams) m_vectorMap->createFromPntMap( s_lakes, viewParams->viewport() ); m_vectorMap->setPen( Qt::NoPen ); m_vectorMap->setBrush( m_textureLakeBrush ); - m_vectorMap->drawMap( origimg, antialiased, viewParams->viewport(), + m_vectorMap->drawMap( origimg.data(), antialiased, viewParams->viewport(), viewParams->mapQuality() ); m_vectorMap->createFromPntMap( s_lakeislands, viewParams->viewport() ); m_vectorMap->setPen( Qt::NoPen ); m_vectorMap->setBrush( m_textureLandBrush ); - m_vectorMap->drawMap( origimg, antialiased, viewParams->viewport(), + m_vectorMap->drawMap( origimg.data(), antialiased, viewParams->viewport(), viewParams->mapQuality() ); } @@ -219,7 +219,7 @@ void VectorComposer::drawTextureMap(ViewParams *viewParams) m_vectorMap->setPen( Qt::NoPen ); m_vectorMap->setBrush( m_textureGlacierBrush ); - m_vectorMap->drawMap( origimg, antialiased, viewParams->viewport(), + m_vectorMap->drawMap( origimg.data(), antialiased, viewParams->viewport(), viewParams->mapQuality() ); } diff --git a/src/lib/ViewParams.cpp b/src/lib/ViewParams.cpp index eed1bef..5b53e7b 100644 --- marble/src/lib/ViewParams.cpp +++ marble/src/lib/ViewParams.cpp @@ -60,8 +60,8 @@ public: GeoSceneSettings m_globalSettings; // Cached data that will make painting faster. - QImage *m_canvasImage; // Base image with space and atmosphere - QImage *m_coastImage; // A slightly higher level image. + QSharedPointer<QImage> m_canvasImage; // Base image with space and atmosphere + QSharedPointer<QImage> m_coastImage; // A slightly higher level image. void initGlobalSettings(); void propagateGlobalToLocalSettings(); @@ -85,8 +85,6 @@ ViewParamsPrivate::ViewParamsPrivate() ViewParamsPrivate::~ViewParamsPrivate() { - delete m_canvasImage; - delete m_coastImage; } void ViewParamsPrivate::initGlobalSettings() @@ -156,7 +154,7 @@ void ViewParams::setProjection(Projection newProjection) // Repaint the background if necessary if ( !currentProjection()->mapCoversViewport( viewport() ) ) { - canvasImage()->fill(0); // Using Qt::transparent is wrong here (equals "18")! + d->m_canvasImage->fill(0); // Using Qt::transparent is wrong here (equals "18")! } } @@ -238,7 +236,7 @@ void ViewParams::setRadius(int newRadius) // Repaint the background if necessary if ( !currentProjection()->mapCoversViewport( viewport() ) ) { - canvasImage()->fill(0); // Using Qt::transparent is wrong here (equals "18")! + d->m_canvasImage->fill(0); // Using Qt::transparent is wrong here (equals "18")! } } @@ -285,8 +283,7 @@ void ViewParams::setSize( int width, int height ) : QImage::Format_ARGB32_Premultiplied; // Recreate the canvas image with the new size. - delete d->m_canvasImage; - d->m_canvasImage = new QImage( width, height, imageFormat ); + d->m_canvasImage = QSharedPointer<QImage>( new QImage( width, height, imageFormat ) ); // Repaint the background if necessary if ( !currentProjection()->mapCoversViewport( viewport() ) ) { @@ -294,20 +291,29 @@ void ViewParams::setSize( int width, int height ) } // Recreate the coastline detection offscreen image - delete d->m_coastImage; - d->m_coastImage = new QImage( width, height, QImage::Format_RGB32 ); + d->m_coastImage = QSharedPointer<QImage>( new QImage( width, height, QImage::Format_RGB32 ) ); } -QImage * ViewParams::canvasImage() const +QSharedPointer<QImage> ViewParams::canvasImagePtr() const { return d->m_canvasImage; } -QImage * ViewParams::coastImage() const +QImage * ViewParams::canvasImage() const +{ + return d->m_canvasImage.data(); +} + +QSharedPointer<QImage> ViewParams::coastImagePtr() const { return d->m_coastImage; } +QImage * ViewParams::coastImage() const +{ + return d->m_coastImage.data(); +} + bool ViewParams::showGps() const { return d->m_showGps; diff --git a/src/lib/ViewParams.h b/src/lib/ViewParams.h index 2abc6d3..43333e7 100644 --- marble/src/lib/ViewParams.h +++ marble/src/lib/ViewParams.h @@ -19,6 +19,7 @@ * @author Inge Wallin <inge@lysator.liu.se> */ +#include <QtCore/QSharedPointer> #include <QtCore/QString> #include "marble_export.h" @@ -114,8 +115,10 @@ class MARBLE_EXPORT ViewParams */ void setSize( int width, int height ); + QSharedPointer<QImage> canvasImagePtr() const; QImage * canvasImage() const; + QSharedPointer<QImage> coastImagePtr() const; QImage * coastImage() const; bool showGps() const;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor