Update of /cvsroot/audacity/audacity-src/src/toolbars
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24160
Modified Files:
TranscriptionToolBar.cpp
Log Message:
Fix memleak.
Index: TranscriptionToolBar.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/TranscriptionToolBar.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- TranscriptionToolBar.cpp 18 Dec 2007 16:10:50 -0000 1.11
+++ TranscriptionToolBar.cpp 23 Mar 2009 22:36:25 -0000 1.12
@@ -84,6 +84,7 @@
: ToolBar(TranscriptionBarID, _("Transcription"), wxT("Transcription"))
{
mPlaySpeed = 1.0;
+ mTimeTrack = NULL;
#ifdef EXPERIMENTAL_VOICE_DETECTION
mVk = new VoiceKey();
#endif
@@ -94,6 +95,9 @@
#ifdef EXPERIMENTAL_VOICE_DETECTION
delete mVk;
#endif
+ if (mTimeTrack) {
+ delete mTimeTrack;
+ }
}
void TranscriptionToolBar::Create(wxWindow * parent)
@@ -362,6 +366,14 @@
return;
}
+ // Create a TimeTrack if we haven't done so already
+ if (!mTimeTrack) {
+ mTimeTrack = new TimeTrack(p->GetDirManager());
+ if (!mTimeTrack) {
+ return;
+ }
+ }
+
// Pop up the button
SetButton(false, mButtons[TTB_PlaySpeed]);
@@ -370,15 +382,9 @@
p->GetControlToolBar()->StopPlaying();
}
- // Can't do anything without a time track
- // TODO: Yikes - Bad coding style.
- // A new time track will be created each time we
- // play-at-speed.
- TimeTrack *tt = new TimeTrack(p->GetDirManager());
-
// Set the speed range
- tt->SetRangeUpper((long int)mPlaySpeed);
- tt->SetRangeLower((long int)mPlaySpeed);
+ mTimeTrack->SetRangeUpper((long int)mPlaySpeed);
+ mTimeTrack->SetRangeLower((long int)mPlaySpeed);
// Get the current play region
double playRegionStart, playRegionEnd;
@@ -392,7 +398,7 @@
playRegionEnd,
false,
false,
- tt);
+ mTimeTrack);
}
}
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs