| @@ -53,8 +53,6 @@ char *Module::_copied_module_settings = 0; | |||||
| Module::Module ( int W, int H, const char *L ) : Fl_Group( 0, 0, W, H, L ) | Module::Module ( int W, int H, const char *L ) : Fl_Group( 0, 0, W, H, L ) | ||||
| { | { | ||||
| init(); | init(); | ||||
| log_create(); | |||||
| } | } | ||||
| Module::Module ( bool is_default, int W, int H, const char *L ) : Fl_Group( 0, 0, W, H, L ), Loggable( !is_default ) | Module::Module ( bool is_default, int W, int H, const char *L ) : Fl_Group( 0, 0, W, H, L ), Loggable( !is_default ) | ||||
| @@ -62,15 +60,11 @@ Module::Module ( bool is_default, int W, int H, const char *L ) : Fl_Group( 0, 0 | |||||
| this->is_default( is_default ); | this->is_default( is_default ); | ||||
| init(); | init(); | ||||
| log_create(); | |||||
| } | } | ||||
| Module::Module ( ) : Fl_Group( 0, 0, 50, 50, "Unnamed" ) | Module::Module ( ) : Fl_Group( 0, 0, 50, 50, "Unnamed" ) | ||||
| { | { | ||||
| init(); | init(); | ||||
| log_create(); | |||||
| } | } | ||||
| Module::~Module ( ) | Module::~Module ( ) | ||||
| @@ -44,6 +44,11 @@ using std::max; | |||||
| #ifndef NDEBUG | |||||
| bool Loggable::_snapshotting = false; | |||||
| int Loggable::_snapshot_count = 0; | |||||
| #endif | |||||
| bool Loggable::_readonly = false; | bool Loggable::_readonly = false; | ||||
| FILE *Loggable::_fp; | FILE *Loggable::_fp; | ||||
| unsigned int Loggable::_log_id = 0; | unsigned int Loggable::_log_id = 0; | ||||
| @@ -533,12 +538,22 @@ Loggable::snapshot ( FILE *fp ) | |||||
| return false; | return false; | ||||
| } | } | ||||
| #ifndef NDEBUG | |||||
| _snapshotting = true; | |||||
| _snapshot_count++; | |||||
| #endif | |||||
| block_start(); | block_start(); | ||||
| Loggable::_snapshot_callback( _snapshot_callback_arg ); | Loggable::_snapshot_callback( _snapshot_callback_arg ); | ||||
| block_end(); | block_end(); | ||||
| #ifndef NDEBUG | |||||
| _snapshotting = false; | |||||
| #endif | |||||
| _fp = ofp; | _fp = ofp; | ||||
| clear_dirty(); | clear_dirty(); | ||||
| @@ -776,6 +791,25 @@ Loggable::log_create ( void ) const | |||||
| /* replaying, don't bother */ | /* replaying, don't bother */ | ||||
| return; | return; | ||||
| #ifndef NDEBUG | |||||
| if ( _snapshotting && _snapshot_count != _num_snapshot ) | |||||
| { | |||||
| _num_snapshot_creates = 1; | |||||
| _num_snapshot = _snapshot_count; | |||||
| } | |||||
| else if ( _snapshotting && _snapshot_count == _num_snapshot ) | |||||
| { | |||||
| _num_snapshot_creates++; | |||||
| ASSERT( _num_snapshot_creates < 2, "Attempt to log creation of same object twice in one snapshot! %s", class_name() ); | |||||
| } | |||||
| else | |||||
| { | |||||
| _num_log_creates++; | |||||
| ASSERT( _num_log_creates < 2, "Attempt to log creation of same object twice in the journal! %s", class_name() ); | |||||
| } | |||||
| #endif | |||||
| log( "%s 0x%X create ", class_name(), _id ); | log( "%s 0x%X create ", class_name(), _id ); | ||||
| Log_Entry e; | Log_Entry e; | ||||
| @@ -96,6 +96,15 @@ private: | |||||
| static unsigned int _relative_id; | static unsigned int _relative_id; | ||||
| #ifndef NDEBUG | |||||
| static bool _snapshotting; | |||||
| static int _snapshot_count; | |||||
| mutable int _num_log_creates; | |||||
| mutable int _num_snapshot; | |||||
| mutable int _num_snapshot_creates; | |||||
| #endif | |||||
| unsigned int _id; | unsigned int _id; | ||||
| Log_Entry *_old_state; | Log_Entry *_old_state; | ||||
| @@ -115,6 +124,12 @@ private: | |||||
| void init ( bool loggable=true ) | void init ( bool loggable=true ) | ||||
| { | { | ||||
| // _new_state | // _new_state | ||||
| #ifndef NDEBUG | |||||
| _num_log_creates = 0; | |||||
| _num_snapshot = 0; | |||||
| _num_snapshot_creates = 0; | |||||
| #endif | |||||
| _old_state = NULL; | _old_state = NULL; | ||||
| _nest = 0; | _nest = 0; | ||||