- Use a NotifyLock instead of (History|Simulation)::set_notify_enabled() method, which is more elegant and also exception-safe
- Delete set_notify_enabled() method from ConcreteHistory; it was both wrong and useless, and caused impredictable behaviour! - Don't make some methods of History and Simulation virtual if we don't want the user to override them - Loading from file and jumping to an instant of the simulation should be much quickier now git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1170 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
737324f250
commit
83b655496f
11 changed files with 94 additions and 73 deletions
|
@ -84,9 +84,6 @@ JumpToDialog::start()
|
|||
// start listening to simulation updates
|
||||
sim.attach(*this);
|
||||
|
||||
// remember state of notifications for History
|
||||
bool reenable = h.is_notify_enabled();
|
||||
|
||||
try
|
||||
{
|
||||
if(_target_instant < h.get_size() - 1)
|
||||
|
@ -94,9 +91,9 @@ JumpToDialog::start()
|
|||
else
|
||||
sim.jump_to(h.get_size() - 1);
|
||||
|
||||
// disable notifications since we could call
|
||||
// disable notifications on History since we could call
|
||||
// run() a lot of times
|
||||
h.set_notify_enabled(false);
|
||||
History::LockNotify h_lock(h);
|
||||
while(h.get_front() <= _target_instant)
|
||||
{
|
||||
sim.run();
|
||||
|
@ -149,7 +146,6 @@ JumpToDialog::start()
|
|||
// Ending successfully: detach me, reenable notifications,
|
||||
// and emit response ``okay''
|
||||
sim.detach(*this);
|
||||
h.set_notify_enabled(reenable);
|
||||
response(Gtk::RESPONSE_OK);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue