src/Ottoman.cpp
changeset 4 715d6147ba3a
parent 0 31a43d94cc26
child 8 21a6c17f4e3e
     1.1 --- a/src/Ottoman.cpp	Sun Sep 20 15:14:12 2009 -0700
     1.2 +++ b/src/Ottoman.cpp	Thu Sep 24 10:36:08 2009 -0700
     1.3 @@ -42,6 +42,7 @@
     1.4      
     1.5      Ottoman::Ottoman()
     1.6      :_writeable(true),
     1.7 +     _file(NULL),
     1.8       _filename(NULL),
     1.9       _lastVersion(NULL),
    1.10       _current( new OverlayDictionary(&Dictionary::kEmpty) )
    1.11 @@ -96,6 +97,9 @@
    1.12              delete _file;
    1.13              _file = curFile;
    1.14          }
    1.15 +        
    1.16 +        if (changed)
    1.17 +            versionsChanged();
    1.18          return changed;
    1.19      }
    1.20      
    1.21 @@ -196,11 +200,12 @@
    1.22          if (!lastVersion)
    1.23              lastVersion = new VersionDictionary(dstFile);
    1.24          VersionDictionary *saved = lastVersion->_appendAndOpen(_current->overlay(), 
    1.25 -                                                            dstFile,
    1.26 -                                                            _current->baseReplaced());
    1.27 +                                                               dstFile,
    1.28 +                                                               _current->baseReplaced());
    1.29          // (don't delete _lastVersion: saved->_previousVersion now points to it.)
    1.30          _lastVersion = saved;
    1.31          _current->revertTo(_lastVersion);
    1.32 +        versionsChanged();
    1.33      }
    1.34      
    1.35      bool Ottoman::save() {
    1.36 @@ -235,6 +240,7 @@
    1.37          File *dstFile = _writeTo(dstFileName, overwriteAllowed);
    1.38          free(_filename);
    1.39          _filename = strdup(dstFileName);
    1.40 +        delete _file;
    1.41          _file = dstFile;
    1.42      }
    1.43