diff --git a/include/isam.cpp b/include/isam.cpp index 2140f188a..6db53cbaf 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -468,9 +468,7 @@ HIDDEN void relisfd(isfdptr & isfd) delete isfd->r; delete isfd; -#ifdef DBG - isfd = NULL; // Per provocare errori -#endif + isfd = NULL; } @@ -1470,7 +1468,7 @@ TLocalisamfile::TLocalisamfile( _oldkey = getkey(); setkey(1); } - else _was_open = FALSE; + else _was_open = TRUE; } // @mfunc Costruttore @@ -1485,9 +1483,12 @@ TLocalisamfile::TLocalisamfile( TLocalisamfile::~TLocalisamfile() { - if (_was_open) - setkey(_oldkey); - close(); + if (_isamfile) + { + if (_was_open) + setkey(_oldkey); + close(); + } } @@ -1495,7 +1496,7 @@ int TLocalisamfile::close() { int err = NOERR; - if (!_was_open) + if (_was_open) { clearfilehnd(); } @@ -1535,13 +1536,13 @@ int TLocalisamfile::open(unsigned int mode) if (openf[logicnum - 1] != NULL) { - _was_open = FALSE; + _was_open = TRUE; _isamfile = openf[logicnum - 1]; } else { err = _open(mode, TRUE); - _was_open = TRUE; + _was_open = FALSE; } setstatus(err); @@ -2886,7 +2887,7 @@ HIDDEN int fld_cmp(const char* a, const char* b, int len, bool number) // TRectype (record di un file) /////////////////////////////////////////////////////////// -RecDes* TRectype::rec_des() const +RecDes* TRectype::rec_des() const { const isdef* i = _logicnum < EXTERNAL_FILE ? openf[_logicnum-1] : ext_files[_logicnum - EXTERNAL_FILE]; CHECKD(i, "Can't use a record of closed file ", _logicnum);