Corretto memory leak in assoc

Terminata la gestione del bottone (unico!) negli sheet


git-svn-id: svn://10.65.10.50/trunk@756 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-12-13 13:51:04 +00:00
parent 34ee6381f7
commit ee2b6f15df
6 changed files with 722 additions and 729 deletions

View File

@ -44,7 +44,12 @@ bool TAssoc_array::add(const char* key, TObject* obj,
if (!isnew)
{
if (force) { o->_obj = obj; }
if (force)
{
if (o->_obj != NULL)
delete o->_obj;
o->_obj = obj;
}
return TRUE;
}
o->_obj = obj;

View File

@ -223,6 +223,8 @@ Serve solo in multiutenza (XENIX).
strcpy(WKey1, FilCheck->Key) ;
WInd = FilCheck->Ind ;
BTrRead(FilCheck, FilCheck->Key, WKey, &WInd1, BError) ;
WPag = FilCheck->CurPag ;
WPos = FilCheck->Pos ;
if (*BError == BTrEmptyTree) return ;
if (FilCheck->Base[FilCheck->PN].DupKeys == TRUE)
{
@ -290,11 +292,6 @@ WKey = variabile di lavoro contenente la chiave.
}
else
{
#ifdef DOS
if (adelete)
{
adelete = FALSE;
#endif
Repos(FilCheck, BError) ;
if (*BError != NoErr)
{
@ -306,11 +303,6 @@ WKey = variabile di lavoro contenente la chiave.
}
return;
}
#ifdef DOS
}
else
if (GetAPage(FilCheck, &PathPage, FilCheck->CurPag, BError) != NoErr) return;
#endif
if (FilCheck->Pos < PathPage.PA.PageHeader.NKey)
{
FilCheck->Pos++;
@ -368,11 +360,6 @@ WKey = variabile di lavoro contenente una chiave.
}
else
{
#ifdef DOS
if (adelete)
{
adelete = FALSE;
#endif
Repos(FilCheck, BError) ;
if ((*BError != NoErr) && (*BError != BTrKeyNotFound))
{
@ -384,11 +371,6 @@ WKey = variabile di lavoro contenente una chiave.
}
return;
}
#ifdef DOS
}
else
if (GetAPage(FilCheck, &PathPage, FilCheck->CurPag, BError) != NoErr) return;
#endif
*BError = NoErr;
if (FilCheck->Pos > 1)
{

View File

@ -64,7 +64,7 @@ void TConfig::_write_file()
{
ifstream in(_file);
TFilename temp;
temp.temp("__tmp__.cnf");
temp.temp("cnf");
ofstream out(temp);
TFixed_string l(__tmp_string, sizeof(__tmp_string));
@ -95,7 +95,8 @@ void TConfig::_write_file()
out.close(); in.close();
TFilename bak(_file); bak.ext("bak");
rename(_file, bak);
rename(temp, _file);
fcopy(temp, _file); // Copia dalla tempdir al nuovo .ini
remove(temp); // Cancella file temporaneo
}

View File

@ -53,9 +53,9 @@ ACCEL MENU_FILE "f" ALT
BMP_SELECT bitmap DISCARDABLE f:\p.due\bmp\select.bmp
// BMP_FIRSTREC bitmap DISCARDABLE f:\p.due\bmp\firstrec.bmp
// BMP_PREVREC bitmap DISCARDABLE f:\p.due\bmp\prevrec.bmp
// BMP_STOPREC bitmap DISCARDABLE f:\p.due\bmp\stoprec.bmp
// BMP_NEXTREC bitmap DISCARDABLE f:\p.due\bmp\nextrec.bmp
// BMP_LASTREC bitmap DISCARDABLE f:\p.due\bmp\lastrec.bmp
BMP_STOPREC bitmap DISCARDABLE f:\p.due\bmp\stoprec.bmp
BMP_SAVEREC bitmap DISCARDABLE f:\p.due\bmp\saverec.bmp
BMP_SAVERECDN bitmap DISCARDABLE f:\p.due\bmp\saverecd.bmp
BMP_NEWREC bitmap DISCARDABLE f:\p.due\bmp\newrec.bmp

View File

@ -47,7 +47,7 @@ class TSpreadsheet : public TWindow
bool _row_dirty; // Current row changed
bool _check_enabled; // Perform OFF_ROW checks
short _icon;
TString16 _button;
static void xiev_handler(XI_OBJ *itf, XI_EVENT *xiev);
void init();
@ -129,7 +129,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
TSheet_field* o)
: _mask(maskname, maskno), _notify(NULL), _edit_field(NULL),
_owner(o), _cur_row(0), _cur_col(0), _active(TRUE),
_row_dirty(FALSE), _check_enabled(TRUE), _firstfocus(TRUE), _icon(0)
_row_dirty(FALSE), _check_enabled(TRUE), _firstfocus(TRUE)
{
const int NUMBER_WIDTH = 3;
const int MAX_COL = 32;
@ -231,6 +231,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
for (h = new_header.get(0), i = 0; h; h = new_header.get(), i++)
{
const TString80 testo(h);
const int cid = FIRST_FIELD+i; // Column & Field ID
const TMask_field* f = field(cid); // Field on mask
const int acqua = f->class_id();
@ -248,20 +249,22 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
if (f->active()) flags |= XI_ATR_ENABLED | XI_ATR_FOCUSBORDER | XI_ATR_AUTOSELECT;
else _column_disabled.set(i);
coldef = xi_add_column_def(listdef, cid, flags, cid, v_width[i], m_width[i], (char*)h);
coldef = xi_add_column_def(listdef, cid, flags, cid, v_width[i], m_width[i],
(char*)(const char*)testo);
coldef->v.column->heading_platform = TRUE;
coldef->v.column->center_heading = TRUE;
if (acqua == CLASS_BUTTON_FIELD)
{
const TString80 testa(header.get(i));
const TFixed_string testa(header.get(i));
const int diesis = testa.find('#');
if (diesis > 0)
{
_icon = atoi(testa.mid(diesis+1));
_button = testa.mid(diesis+1);
coldef->v.column->icon_x = (v_width[i]*CHARX-16) >> 1;
coldef->v.column->icon_y = (CHARY-16) >> 1;
coldef->v.column->column_platform = TRUE;
}
else _button = testo;
}
}
@ -482,8 +485,10 @@ break;
if (acqua == CLASS_BUTTON_FIELD)
{
xiev->v.cell_request.icon_rid = _icon;
src = NULL;
if (isdigit(_button[0]))
xiev->v.cell_request.icon_rid = atoi(_button);
else
src = _button;
}
else
{

View File

@ -82,8 +82,8 @@ const char* cmd2name(const char* argv0, const char* argv1)
const int par = app.find(" -");
if (par > 0)
{
int num = atoi(app.mid(par+2)) + 1;
char c = (num > 9) ? ('a'+num-10) : ('0'+num);
const int num = atoi(app.mid(par+2)) + 1;
const char c = (num > 9) ? ('a'+num-10) : ('0'+num);
app.cut(par);
app << c << "00";
}