Browse Source

Fix occasional segfault upon loading snapshots.

Sometimes the situation could arise where a log ID referred to by a
log entry's property list coincided with the temporary log ID
associated with the object being created--usually resulting in an
immediate segfault. Assigning the final log ID BEFORE setting the
properties prevents this from happening.
tags/non-daw-v1.1.0
Jonathan Moore Liles 16 years ago
parent
commit
8a76b01db9
2 changed files with 4 additions and 4 deletions
  1. +1
    -2
      Timeline/Loggable.C
  2. +3
    -2
      Timeline/Loggable.H

+ 1
- 2
Timeline/Loggable.C View File

@@ -336,8 +336,7 @@ Loggable::do_this ( const char *s, bool reverse )

{
/* create */
Loggable *l = _class_map[ std::string( classname ) ]( e );
l->update_id( id );
Loggable *l = _class_map[ std::string( classname ) ]( e, id );
l->log_create();
}



+ 3
- 2
Timeline/Loggable.H View File

@@ -38,7 +38,7 @@ typedef void (snapshot_func)( void * );

class Log_Entry;
class Loggable;
typedef Loggable *(create_func)(Log_Entry &);
typedef Loggable *(create_func)(Log_Entry &, int id);

#define LOG_REGISTER_CREATE( class ) \
Loggable::register_create( #class, & class ::create );
@@ -48,9 +48,10 @@ typedef Loggable *(create_func)(Log_Entry &);

#define LOG_CREATE_FUNC( class ) \
static Loggable * \
create ( Log_Entry &e ) \
create ( Log_Entry &e, int id ) \
{ \
class *r = new class; \
r->update_id( id ); \
r->set( e ); \
return (Loggable *)r; \
} \


Loading…
Cancel
Save