[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kstars-devel
Subject:    [Kstars-devel] KDE/kdeedu/kstars/kstars
From:       Jason Harris <kstars () 30doradus ! org>
Date:       2007-10-27 15:36:52
Message-ID: 1193499412.561055.10502.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 729977 by harris:

Jure: thanks for finding a memory leak in KStars!  Unfortunately, your fix
was not correct, because we set "pLast = pThis" prior to your "delete
pThis".  Therefore, pLast would be a null pointer when we still need
it.

Instead, I have made pThis and pLast normal objects, rather than
pointers.  James, can you review this patch?  I am in the midst of a
large set of changes ATM, so my local copy is not compilable.

CCMAIL: jlp@holodeck1.com
CCMAIL: kstars-devel@kde.org



 M  +9 -10     skymapdraw.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skymapdraw.cpp #729976:729977
@@ -227,41 +227,40 @@
     if (bound->size() < 2) return;
 
     bool isVisible, isVisibleLast;
-    SkyPoint  *pThis, *pLast;
+    SkyPoint pThis, pLast;
     QPointF oThis, oLast, oMid;
 
     QPointF node = bound->at( 0 );
-    pLast = new SkyPoint( node.x(), node.y() );
+    pLast.set( node.x(), node.y() );
 
-    pLast->EquatorialToHorizontal( data->LST, data->geo()->lat() );
-    oLast = toScreen( pLast, Options::useRefraction(), &isVisibleLast );
+    pLast.EquatorialToHorizontal( data->LST, data->geo()->lat() );
+    oLast = toScreen( &pLast, Options::useRefraction(), &isVisibleLast );
 
     int limit = bound->size();
 
     for ( int i=1 ; i < limit ; i++ ) {
         node = bound->at( i );
-        pThis = new SkyPoint( node.x(), node.y() );
-        pThis->EquatorialToHorizontal( data->LST, data->geo()->lat() );
-        oThis = toScreen( pThis, Options::useRefraction(), &isVisible );
+        pThis.set( node.x(), node.y() );
+        pThis.EquatorialToHorizontal( data->LST, data->geo()->lat() );
+        oThis = toScreen( &pThis, Options::useRefraction(), &isVisible );
 
         if ( isVisible && isVisibleLast ) {
             psky.drawLine( oLast, oThis );
         }
 
         else if ( isVisibleLast ) {
-            oMid = clipLineI( pLast, pThis );
+            oMid = clipLineI( &pLast, &pThis );
             // -jbb printf("oMid: %4d %4d\n", oMid.x(), oMid.y());
             psky.drawLine( oLast, oMid );
         }
         else if ( isVisible ) {
-            oMid = clipLineI( pThis, pLast );
+            oMid = clipLineI( &pThis, &pLast );
             psky.drawLine( oMid, oThis );
         }
 
         pLast = pThis;
         oLast = oThis;
         isVisibleLast = isVisible;
-        delete pThis;
     }
     /****
     	QPolygonF poly;
_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic