Changeset 107 for osgVisual


Ignore:
Timestamp:
Jul 30, 2010, 8:56:43 AM (14 years ago)
Author:
Torben Dannhauer
Message:

Removed two memory leaks!

Location:
osgVisual
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/include/sky_Silverlining/skySilverLining_ProjectionMatrixCallback.h

    r88 r107  
    9999           //OSG_NOTIFY( osg::ALWAYS ) << "znear: " << znear << ", zfar: " << zfar << std::endl;
    100100
    101            if (skyDrawable)
     101           if (skyDrawable.valid())
    102102           {
    103103               skyDrawable->setSkyboxSize(((zfar - znear) * 0.5 + znear) * 2.0);
     
    124124           //OSG_NOTIFY( osg::ALWAYS ) << "znear: " << znear << ", zfar: " << zfar << std::endl;
    125125
    126            if (skyDrawable)
     126           if (skyDrawable.valid())
    127127           {
    128128               skyDrawable->setSkyboxSize(((zfar - znear) * 0.5 + znear) * 2.0);
     
    222222                //clamp the near plane if low above ground.
    223223            double x,y,z,hat;
    224             util::getXYZofCamera( camera, x, y, z );
    225                 if( util::queryHeightAboveTerrainInWorld( hat, csn, x, y, z ) )
     224                util::getXYZofCamera( camera.get(), x, y, z );
     225                if( util::queryHeightAboveTerrainInWorld( hat, csn.get(), x, y, z ) )
    226226                {
    227227                        if (hat < 80 ) 
     
    238238                near_ = 2;
    239239                far_ = 125000;
    240             util::getXYZofCamera( camera, x, y, z );
    241                 if( util::queryHeightAboveTerrainInWorld( hat, csn, x, y, z ) )
     240            util::getXYZofCamera( camera.get(), x, y, z );
     241                if( util::queryHeightAboveTerrainInWorld( hat, csn.get(), x, y, z ) )
    242242                {
    243243                        osg::Vec2 planesNearFar;
     
    259259         * Pointer to the Cullvisitor which applies the projection matrix.
    260260         */
    261         osgUtil::CullVisitor *stockCullVisitor;
     261        osg::ref_ptr<osgUtil::CullVisitor> stockCullVisitor;
    262262
    263263        /**
    264264         * Pointer to silverlinings atmosphere instance.
     265         * It has to be a pure C++ Pointer, because SilverLining::athmosphere is not derived from osg/Referenced
    265266         */
    266267    SilverLining::Atmosphere *atmosphere;
     
    269270         * Pointer to the camera on which the callback is installed
    270271         */
    271     osg::Camera *camera;
     272        osg::observer_ptr<osg::Camera> camera;
    272273
    273274        /**
    274275         * Pointer to the skyDrawable
    275276         */
    276         skySilverLining_skyDrawable *skyDrawable;
     277        osg::observer_ptr<skySilverLining_skyDrawable> skyDrawable;
    277278
    278279        /**
     
    280281         * @todo: wofür ist diese variable nötig?
    281282         */
    282         osg::CoordinateSystemNode *csn;
     283        osg::observer_ptr<osg::CoordinateSystemNode> csn;
    283284
    284285
  • osgVisual/src/cluster/dataIO_clusterENet_implementation.cpp

    r95 r107  
    262262void dataIO_clusterENet_implementation::onReceivePacket(ENetEvent* event_)
    263263{
    264                 receivedTransportContainer.assign((char*)(event_->packet->data), event_->packet->dataLength);   
    265                 //std::cout << "A packet of length "<<event_->packet->dataLength<<" containing "<<receivedTransportContainer<<" was received from "<<receivedTransportContainer<<" on channel "<<(int)(event_->channelID)<<std::endl;
     264                receivedTransportContainer.assign((char*)(event_->packet->data), event_->packet->dataLength);
     265                enet_packet_destroy(event_->packet);   
     266                //std::cout << "A packet of length "<<receivedTransportContainer.size()<<" containing "<<receivedTransportContainer<<" was received from "<<receivedTransportContainer<<" on channel "<<(int)(event_->channelID)<<std::endl;
    266267}
    267268
Note: See TracChangeset for help on using the changeset viewer.