Timeline: Fix double free of Sequence_Widget::_label.
This commit is contained in:
parent
360f4f2481
commit
73ebd3534b
|
@ -67,8 +67,6 @@ Annotation_Region::Annotation_Region ( Sequence *sequence, nframes_t when, const
|
|||
|
||||
Annotation_Region::Annotation_Region ( const Annotation_Region &rhs ) : Sequence_Region( rhs )
|
||||
{
|
||||
_label = strdup( rhs._label );
|
||||
|
||||
log_create();
|
||||
}
|
||||
|
||||
|
@ -76,7 +74,6 @@ Annotation_Region::Annotation_Region ( const Annotation_Region &rhs ) : Sequence
|
|||
Annotation_Region::~Annotation_Region ( )
|
||||
{
|
||||
log_destroy();
|
||||
if ( _label ) free( _label );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -25,23 +25,15 @@
|
|||
|
||||
Sequence_Point::Sequence_Point ( const Sequence_Point &rhs ) : Sequence_Widget( rhs )
|
||||
{
|
||||
if ( rhs._label )
|
||||
_label = strdup( rhs._label );
|
||||
else
|
||||
_label = 0;
|
||||
}
|
||||
|
||||
Sequence_Point::Sequence_Point ( )
|
||||
{
|
||||
_label = NULL;
|
||||
|
||||
color( FL_CYAN );
|
||||
}
|
||||
|
||||
Sequence_Point::~Sequence_Point ( )
|
||||
{
|
||||
if ( _label )
|
||||
free( _label );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,25 +31,15 @@ protected:
|
|||
void get ( Log_Entry &e ) const;
|
||||
void set ( Log_Entry &e );
|
||||
|
||||
|
||||
virtual void draw_box ( void );
|
||||
virtual void draw ( void );
|
||||
|
||||
Sequence_Point ( const Sequence_Point &rhs );
|
||||
Sequence_Point ( );
|
||||
~Sequence_Point ( );
|
||||
virtual ~Sequence_Point ( );
|
||||
|
||||
public:
|
||||
|
||||
const char *label ( void ) const { return _label; }
|
||||
void label ( const char *s )
|
||||
{
|
||||
if ( _label )
|
||||
free( _label );
|
||||
_label = strdup( s );
|
||||
redraw();
|
||||
}
|
||||
|
||||
Fl_Align align ( void ) const { return FL_ALIGN_RIGHT; }
|
||||
virtual int abs_w ( void ) const { return 8; }
|
||||
|
||||
|
|
|
@ -59,6 +59,8 @@ Sequence_Widget::Sequence_Widget ( const Sequence_Widget &rhs ) : Loggable( rhs
|
|||
|
||||
if ( rhs._label )
|
||||
_label = strdup( rhs._label );
|
||||
else
|
||||
_label = 0;
|
||||
|
||||
_sequence = rhs._sequence;
|
||||
|
||||
|
|
|
@ -32,10 +32,11 @@ class Tempo_Point : public Sequence_Point
|
|||
void
|
||||
_make_label ( void )
|
||||
{
|
||||
if ( ! _label )
|
||||
_label = (char*)malloc( 40 );
|
||||
char l[10];
|
||||
|
||||
snprintf( _label, 40, "%.1f", _tempo );
|
||||
snprintf( l, sizeof(l), "%.1f", _tempo );
|
||||
|
||||
label( l );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
|
||||
Tempo_Point ( nframes_t when, float bpm );
|
||||
|
||||
~Tempo_Point ( );
|
||||
virtual ~Tempo_Point ( );
|
||||
|
||||
Tempo_Point ( const Tempo_Point &rhs ) : Sequence_Point( rhs )
|
||||
{
|
||||
|
|
|
@ -44,10 +44,11 @@ class Time_Point : public Sequence_Point
|
|||
void
|
||||
_make_label ( void )
|
||||
{
|
||||
if ( ! _label )
|
||||
_label = (char*)malloc( 40 );
|
||||
char l[10];
|
||||
|
||||
snprintf( l, sizeof(l), "%d/%d", _time.beats_per_bar, _time.beat_type );
|
||||
|
||||
snprintf( _label, 40, "%d/%d", _time.beats_per_bar, _time.beat_type );
|
||||
label( l );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue