Bug 311624

Summary: Mable crash after scrolling a map in the "Flat Map" projection
Product: [Applications] marble Reporter: Oleg Lyubimov <lyubimov.o.e>
Component: generalAssignee: marble-bugs
Status: RESOLVED DUPLICATE    
Severity: critical CC: shentey
Priority: NOR    
Version: 1.4 (KDE 4.9)   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Simple Fix of the Bug

Description Oleg Lyubimov 2012-12-13 09:25:36 UTC
Marble crashes when you scroll a map and change zoom level in the "Flat Map" projection. This bug has reproducing probability 80-90% (100% if you use slow hardware). The bug is reproduced on Desktop and on QML marble application. 

Reproducible: Always

Steps to Reproduce:
1. Download sources, build(QT only, Debug), install and run marble
2. Check a map witch has tile level more than 1. I checked "Historical Map 1689"
3. When the map is opened, set a Projection to "Flat Map" set zoom to minimum, and drag the map (it will be looked sush as a tape) to the Top Bourder (or Bottom Bourder) of Marble Widget.
4. Press left mouse and scroll the map from left to right (the map should scrolling by "inertia" several seconds after you release left mouse button)
5. When the will be scrolling by "inertia", you should increase or decrease zoom of the map and grag it from Top to Bottom(Bottom to Top). 
6. After several reps of the 4 and 5 steps the Error should be accours. Sometimes is reproduce in the first rep, but often you should make 5 - 20 reps of  4 and 5 steps.
5. When you open    
Actual Results:  
------- GDB log------------------------------
-------------------------------------------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb3bffb40 (LWP 17144)]
Marble::StackedTile::pixel (this=0xb3d0c3f8, x=559, y=-2027) at /home/olyubimov/git_repository/marble/src/lib/StackedTile.cpp:262
262	    return d->pixel( x, y );
(gdb) ba
#0  Marble::StackedTile::pixel (this=0xb3d0c3f8, x=559, y=-2027) at /home/olyubimov/git_repository/marble/src/lib/StackedTile.cpp:262
#1  0x012b6f22 in Marble::ScanlineTextureMapperContext::pixelValueApprox (this=0xb3bff1ec, lon=-0.90835936550699259, lat=1.5724603059378008, 
    scanLine=<optimized out>, n=8) at /home/olyubimov/git_repository/marble/src/lib/ScanlineTextureMapperContext.cpp:338
#2  0x012b9245 in Marble::EquirectScanlineTextureMapper::RenderJob::run (this=0x89dbb90)
    at /home/olyubimov/git_repository/marble/src/lib/EquirectScanlineTextureMapper.cpp:231
#3  0x0018d39b in QThreadPoolThread::run (this=0x8b9a2a0) at concurrent/qthreadpool.cpp:107
#4  0x0019ade0 in QThreadPrivate::start (arg=0x8b9a2a0) at thread/qthread_unix.cpp:298
#5  0x0179fd4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0x016ddd3e in clone () from /lib/i386-linux-gnu/libc.so.6


Expected Results:  
No crash

Marble version is 1.4.9 (1.5.0 RC 1)
Operating system Xubuntu 11.10
Qt version 4.8.1

Image with clarification of activityes to reproduce it.
http://postimage.org/image/5h0b2pf4r/

PS. Sorry for my terrible english.
Comment 1 Oleg Lyubimov 2012-12-17 06:46:26 UTC
Created attachment 75878 [details]
Simple Fix of the Bug

This bug is generated when function Marble::StackedTile::pixel (this=0xb3d0c3f8, x=559, y=-2027) takes arguments with invalid values. I create simple patch (see attachment) to add code, which limits the arguments. Because "x" and "y" args are the pixel values the bottom bound or this args is 0, and the top bounds of the args is  QImage m_resultTile.width() and QImage m_resultTile.heidth(). If you limit the "x" and "y" args by this bounds the bug not reproduces.
Comment 2 Bernhard Beschow 2013-01-10 22:09:28 UTC

*** This bug has been marked as a duplicate of bug 305324 ***