Browse Source

Mixer: Fix segfault in module paste.

tags/non-daw-v1.2.0
Jonathan Moore Liles 12 years ago
parent
commit
3a999ecc86
4 changed files with 46 additions and 14 deletions
  1. +29
    -2
      mixer/src/Module.C
  2. +1
    -12
      mixer/src/Module.H
  3. +13
    -0
      nonlib/Log_Entry.C
  4. +3
    -0
      nonlib/Log_Entry.H

+ 29
- 2
mixer/src/Module.C View File

@@ -190,8 +190,15 @@ Module::paste_before ( void )
{
Module *m = _copied_module_empty;

m->chain( chain() );
Log_Entry le( _copied_module_settings );
le.remove( ":chain" );

char *print = le.print();

DMESSAGE( "Pasting settings: %s", print );

free( print );

m->set( le );

if ( ! chain()->insert( this, m ) )
@@ -203,7 +210,7 @@ Module::paste_before ( void )
_copied_module_settings = NULL;
_copied_module_empty = NULL;

/* set up for another copy */
/* set up for another paste */
m->copy();
}

@@ -429,6 +436,26 @@ Module::set ( Log_Entry &e )


void
Module::chain ( Chain *v )
{
if ( _chain != v )
{
DMESSAGE( "Adding module %s in to chain %s", label(), v ? v->name() : "NULL" );

_chain = v;

for ( int i = 0; i < ncontrol_inputs(); ++i )
{
control_input[i].update_osc_port();
}
}
else
{
DMESSAGE( "Module %s already belongs to chain %s", label(), v ? v->name() : "NULL" );
}
}

/* return a string serializing this module's parameter settings. The
format is 1.0:2.0:... Where 1.0 is the value of the first control
input, 2.0 is the value of the second control input etc.


+ 1
- 12
mixer/src/Module.H View File

@@ -373,18 +373,7 @@ public:
}

Chain *chain ( void ) const { return _chain; }
void chain ( Chain * v )
{
if ( _chain != v )
{
_chain = v;

for ( int i = 0; i < ncontrol_inputs(); ++i )
{
control_input[i].update_osc_port();
}
}
}
void chain ( Chain * v );

char *get_parameters ( void ) const;
void set_parameters ( const char * );


+ 13
- 0
nonlib/Log_Entry.C View File

@@ -280,6 +280,19 @@ Log_Entry::get ( int n, const char **name, const char **value ) const
}


void
Log_Entry::remove ( const char *name )
{
for ( int i = 0; i < _i; i++ )
{
if ( !strcmp( _sa[ i ], name ) )
{
free( _sa[i] );
_sa[i] = NULL;
}
}
}

char **
Log_Entry::sa ( void )
{


+ 3
- 0
nonlib/Log_Entry.H View File

@@ -88,6 +88,9 @@ public:
/* _sa.push( p ); \ */
/* } \ */


void remove ( const char *s );

ADD( int, "%d", v );
ADD( nframes_t, "%lu", (unsigned long)v );
ADD( unsigned long, "%lu", v );


Loading…
Cancel
Save