Bug 91699

Summary: KSnake: address of temporary
Product: [Unmaintained] ksnake Reporter: Marcin Garski <mgarski>
Component: generalAssignee: Andrew Chant <andrew.chant>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Marcin Garski 2004-10-19 18:34:34 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

In rattler.cpp there is line:

bitBlt(this, 0, 0, &pix->levelPix(), 0, 0, rect().width(), rect().height());

During compile compiler said:
warning: taking address of temporary

Suggested resolution (taken from http://kde.gnusoft.net/3.1.4/AIX/patches/kdegames-3.1.4-xlc.patch):

QPixmap levelPix = pix->levelPix();
bitBlt(this, 0, 0, &levelPix, 0, 0, rect().width(), rect().height());
Comment 1 Albert Astals Cid 2004-11-04 21:39:34 UTC
CVS commit by aacid: 

One warning less
BUG: 91699


  M +2 -1      rattler.cpp   1.47


--- kdegames/ksnake/rattler.cpp  #1.46:1.47
@@ -158,5 +158,6 @@ void Rattler::timerEvent( QTimerEvent * 
                 levelUp();
 
-        bitBlt(this, 0, 0, &pix->levelPix(), 0, 0, rect().width(), rect().height());
+        QPixmap levelPix = pix->levelPix();
+        bitBlt(this, 0, 0, &levelPix, 0, 0, rect().width(), rect().height());
 }