Bug 271798

Summary: Crash when panning by clicking map edges
Product: [Applications] marble Reporter: Jaime Silva <jaimes>
Component: generalAssignee: marble-bugs
Status: RESOLVED FIXED    
Severity: crash CC: Ch.Ehrlicher, jensmh, nienhueser, rahn, shentey
Priority: NOR    
Version: unspecified   
Target Milestone: 1.2 (KDE 4.7)   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Jaime Silva 2011-04-26 19:28:07 UTC
Version:           unspecified
OS:                MS Windows

When compiling marble on windows using MSVC2008 you get this warning

..\src\lib\marblewidget.cpp(60) : warning C4717: 'Marble::sqrt' : recursive on all control paths, function will cause runtime stack overflow

This appears to be exactly what happens when you pan the map by clicking on the widget edges since that causes Marble::moveStep() to get called which uses the sqrt() function.

The same thing appears to happen when using the 1.1.0 binary release for windows.


Reproducible: Didn't try
Comment 1 Dennis Nienhüser 2011-04-28 00:00:32 UTC
Seems to be this one:

#ifdef Q_CC_MSVC
# ifndef KDEWIN_MATH_H
   static long double sqrt( int a ) { return sqrt( (long double)a ); }
# endif
#endif

Looks like a wrong attempt to fix a compiler error to me. I'll CC everyone who "git blame" thinks touched that part. I don't have a MSVC system around atm.
Comment 2 Jaime Silva 2011-04-28 18:34:03 UTC
From what I can tell MSVC2008 seems to work fine without that bit of code. Perhaps it was added to address a bug in an older version of the compiler.

What's a little puzzling is that the compiler chooses to use that sqrt function instead of one of the versions in cmath which are a better match.

Adding 'std::' here to the sqrt call seems to work as well but I'm not sure how an older version of the compiler would behave.

#ifdef Q_CC_MSVC
# ifndef KDEWIN_MATH_H
   static long double sqrt( int a ) { return std::sqrt( (long double)a ); }
# endif
#endif