From 00f8463ab42692427a479151a797a1c9a3e1712a Mon Sep 17 00:00:00 2001 From: timoore <timoore> Date: Thu, 24 Jan 2008 23:05:58 +0000 Subject: [PATCH] Another round of memory leak fixes from Till Busch --- src/Cockpit/hud.cxx | 2 +- src/Cockpit/hud.hxx | 2 +- src/Instrumentation/HUD/HUD.hxx | 8 ++++---- src/Instrumentation/HUD/HUD_instrument.cxx | 1 - src/Instrumentation/HUD/HUD_label.cxx | 1 - src/Instrumentation/HUD/HUD_misc.cxx | 1 - src/Main/main.cxx | 3 --- src/Traffic/Schedule.cxx | 2 +- 8 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index 35513b45c..606a29efb 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -63,7 +63,7 @@ static HUD_Properties *HUDprop = 0; static char units[5]; -deque<instr_item *> HUD_deque; +deque<SGSharedPtr<instr_item> > HUD_deque; fgTextList HUD_TextList; fgLineList HUD_LineList; diff --git a/src/Cockpit/hud.hxx b/src/Cockpit/hud.hxx index 69759dd4f..91249e851 100644 --- a/src/Cockpit/hud.hxx +++ b/src/Cockpit/hud.hxx @@ -367,7 +367,7 @@ extern fgLineList HUD_LineList; extern fgLineList HUD_StippleLineList; -class instr_item { // An Abstract Base Class (ABC) +class instr_item : public SGReferenced { // An Abstract Base Class (ABC) private: static UINT instances; // More than 64K instruments? Nah! static int brightness; diff --git a/src/Instrumentation/HUD/HUD.hxx b/src/Instrumentation/HUD/HUD.hxx index d1d987dbb..af8816d47 100644 --- a/src/Instrumentation/HUD/HUD.hxx +++ b/src/Instrumentation/HUD/HUD.hxx @@ -23,6 +23,7 @@ #define _HUD_HXX #include <simgear/compiler.h> +#include <simgear/props/condition.hxx> #ifdef HAVE_CONFIG_H # include <config.h> @@ -52,7 +53,6 @@ SG_USING_NAMESPACE(std); class FGViewer; -class SGCondition; class LineSegment { @@ -344,7 +344,7 @@ protected: float _center_x, _center_y; private: - SGCondition *_condition; + SGSharedPtr<SGCondition> _condition; float _disp_factor; // Multiply by to get numbers shown on scale. float _scr_span; // Working values for draw; int _digits; @@ -370,7 +370,7 @@ private: float _pointer_width; float _pointer_length; - SGCondition *_blink_condition; + SGSharedPtr<SGCondition> _blink_condition; double _blink_interval; double _blink_target; // time for next blink state change bool _blink_state; @@ -583,7 +583,7 @@ public: virtual void draw(); private: - SGCondition *_active_condition; // stadiametric (true) or standby (false) + SGSharedPtr<SGCondition> _active_condition; // stadiametric (true) or standby (false) Input _diameter; // inner/outer radius relation float _bullet_size; float _inner_radius; diff --git a/src/Instrumentation/HUD/HUD_instrument.cxx b/src/Instrumentation/HUD/HUD_instrument.cxx index b52a3e148..b9bc717f4 100644 --- a/src/Instrumentation/HUD/HUD_instrument.cxx +++ b/src/Instrumentation/HUD/HUD_instrument.cxx @@ -24,7 +24,6 @@ #endif #include <simgear/math/SGLimits.hxx> -#include <simgear/props/condition.hxx> #include "HUD.hxx" diff --git a/src/Instrumentation/HUD/HUD_label.cxx b/src/Instrumentation/HUD/HUD_label.cxx index 431b8ae98..3b83c9f58 100644 --- a/src/Instrumentation/HUD/HUD_label.cxx +++ b/src/Instrumentation/HUD/HUD_label.cxx @@ -23,7 +23,6 @@ # include <config.h> #endif -#include <simgear/props/condition.hxx> #include "HUD.hxx" diff --git a/src/Instrumentation/HUD/HUD_misc.cxx b/src/Instrumentation/HUD/HUD_misc.cxx index d91916fca..021e22ba2 100644 --- a/src/Instrumentation/HUD/HUD_misc.cxx +++ b/src/Instrumentation/HUD/HUD_misc.cxx @@ -22,7 +22,6 @@ # include <config.h> #endif -#include <simgear/props/condition.hxx> #include "HUD.hxx" diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 942b715fe..2eb7686f3 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -492,9 +492,6 @@ static void fgMainLoop( void ) { // Do any I/O channel work that might need to be done globals->get_io()->update( real_delta_time_sec ); - // see if we need to load any deferred-load textures - globals->get_matlib()->load_next_deferred(); - // Run audio scheduler #ifdef ENABLE_AUDIO_SUPPORT if ( globals->get_soundmgr()->is_working() ) { diff --git a/src/Traffic/Schedule.cxx b/src/Traffic/Schedule.cxx index 35a1e44c9..ac2a305c4 100644 --- a/src/Traffic/Schedule.cxx +++ b/src/Traffic/Schedule.cxx @@ -231,7 +231,7 @@ bool FGAISchedule::update(time_t now) if (!deptime) deptime = (*flights.begin())->getDepartureTime(); FGScheduledFlightVecIterator i = flights.begin(); - SG_LOG (SG_GENERAL, SG_INFO,"Processing registration " << registration << " with callsign " << (*i)->getCallSign()); + SG_LOG (SG_GENERAL, SG_DEBUG,"Processing registration " << registration << " with callsign " << (*i)->getCallSign()); if (AIManagerRef) { // Check if this aircraft has been released.