fixes to window list utilities

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@482 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-02-01 21:35:35 +00:00
parent cfc60af057
commit 48264db7a3
5 changed files with 29 additions and 19 deletions

View File

@ -557,15 +557,16 @@ editAccWindow( Widget parent, Account *acc )
} }
/********************************************************************\ /********************************************************************\
* Don't delete any structures -- the close callback wil do this *
\********************************************************************/ \********************************************************************/
void xaccDestroyEditAccWindow (Account * acc) void xaccDestroyEditAccWindow (Account * acc)
{ {
EditAccWindow *editAccData; EditAccWindow *editAccData;
REMOVE_FROM_LIST (EditAccWindow,editAccList,acc,account,editAccData); FIND_IN_LIST (EditAccWindow,editAccList,acc,account,editAccData);
if (!editAccData) return;
XtDestroyWidget (editAccData->dialog); XtDestroyWidget (editAccData->dialog);
free (editAccData);
} }
/********************************************************************\ /********************************************************************\
@ -585,7 +586,7 @@ closeEditAccWindow( Widget mw, XtPointer cd, XtPointer cb )
EditAccWindow *editAccData = (EditAccWindow *)cd; EditAccWindow *editAccData = (EditAccWindow *)cd;
Account *acc = editAccData->account; Account *acc = editAccData->account;
REMOVE_FROM_LIST (EditAccWindow,editAccList,acc,account,editAccData); REMOVE_FROM_LIST (EditAccWindow,editAccList,acc,account);
free(editAccData); free(editAccData);
DEBUG("close EditAccWindow"); DEBUG("close EditAccWindow");
} }
@ -917,6 +918,7 @@ editNotesWindow (Account *acc)
} }
/********************************************************************\ /********************************************************************\
* don't delete any structures; te close callack will do this *
\********************************************************************/ \********************************************************************/
void void
@ -924,10 +926,10 @@ xaccDestroyEditNotesWindow (Account *acc)
{ {
EditNotesWindow *edwin; EditNotesWindow *edwin;
REMOVE_FROM_LIST (EditNotesWindow,editNotesList,acc,account,edwin) FIND_IN_LIST (EditNotesWindow,editNotesList,acc,account,edwin)
if (!edwin) return;
xaccDestroyTextBox (edwin->tb); xaccDestroyTextBox (edwin->tb);
free (edwin);
} }
/********************************************************************\ /********************************************************************\
@ -937,8 +939,12 @@ static void
closeEditNotesWindow( Widget mw, XtPointer cd, XtPointer cb ) closeEditNotesWindow( Widget mw, XtPointer cd, XtPointer cb )
{ {
EditNotesWindow *enw = (EditNotesWindow *) cd; EditNotesWindow *enw = (EditNotesWindow *) cd;
Account * acc = enw->account;
xaccDestroyEditNotesWindow (enw->account); REMOVE_FROM_LIST (EditNotesWindow,editNotesList,acc,account)
xaccDestroyTextBox (enw->tb);
free (enw);
DEBUG("close EditNotesWindow"); DEBUG("close EditNotesWindow");
} }

View File

@ -236,6 +236,7 @@ adjBWindow( Widget parent, Account *acc )
} }
/********************************************************************\ /********************************************************************\
* Don't delete any structures, the close callback will do this *
\********************************************************************/ \********************************************************************/
void void
@ -243,9 +244,9 @@ xaccDestroyAdjBWindow (Account *acc)
{ {
AdjBWindow *adjBData; AdjBWindow *adjBData;
REMOVE_FROM_LIST (AdjBWindow, adjBList, acc, acc, adjBData); FIND_IN_LIST (AdjBWindow, adjBList, acc, acc, adjBData);
if (!adjBData) return;
XtDestroyWidget (adjBData->dialog); XtDestroyWidget (adjBData->dialog);
free (adjBData);
} }
/********************************************************************\ /********************************************************************\
@ -264,7 +265,7 @@ adjBClose( Widget mw, XtPointer cd, XtPointer cb )
AdjBWindow *adjBData = (AdjBWindow *)cd; AdjBWindow *adjBData = (AdjBWindow *)cd;
Account *acc = adjBData->acc; Account *acc = adjBData->acc;
REMOVE_FROM_LIST (AdjBWindow, adjBList, acc, acc, adjBData); REMOVE_FROM_LIST (AdjBWindow, adjBList, acc, acc);
free(adjBData); free(adjBData);
DEBUG("closed AdjBWindow"); DEBUG("closed AdjBWindow");

View File

@ -247,7 +247,7 @@ xaccReadData( char *datafile )
/* create a lost account, put the missing accounts there */ /* create a lost account, put the missing accounts there */
acc = mallocAccount(); acc = mallocAccount();
acc -> accountName = XtNewString (LOST_ACC_STR); acc -> accountName = strdup (LOST_ACC_STR);
acc -> children = (struct _account_group *) holder; acc -> children = (struct _account_group *) holder;
insertAccount (grp, acc); insertAccount (grp, acc);
} else { } else {
@ -538,7 +538,7 @@ readTransaction( int fd, Account *acc, int token )
return NULL; return NULL;
} }
xaccTransSetMemo (trans, tmp); xaccTransSetMemo (trans, tmp);
XtFree (tmp); free (tmp);
/* action first introduced in version 3 of the file format */ /* action first introduced in version 3 of the file format */
if (3 <= token) { if (3 <= token) {
@ -759,7 +759,7 @@ readSplit ( int fd, int token )
return NULL; return NULL;
} }
xaccSplitSetMemo (split, tmp); xaccSplitSetMemo (split, tmp);
XtFree (tmp); free (tmp);
tmp = readString( fd, token ); tmp = readString( fd, token );
if( tmp == NULL ) if( tmp == NULL )
@ -850,12 +850,12 @@ readString( int fd, int token )
return NULL; return NULL;
XACC_FLIP_INT (size); XACC_FLIP_INT (size);
str = (char *)XtMalloc(size); str = (char *) malloc (size);
err = read( fd, str, size ); err = read( fd, str, size );
if( err != size ) if( err != size )
{ {
printf( "Error: readString: size = %d err = %d str = %s\n", size, err, str ); printf( "Error: readString: size = %d err = %d str = %s\n", size, err, str );
XtFree(str); free(str);
return NULL; return NULL;
} }

View File

@ -155,10 +155,11 @@ xaccDestroyMainArrow (Account *acc )
{ {
MainArrow *arrowData; MainArrow *arrowData;
REMOVE_FROM_LIST (MainArrow, arrowList, acc, account, arrowData); FIND_IN_LIST (MainArrow, arrowList, acc, account, arrowData);
if (!arrowData) return; if (!arrowData) return;
REMOVE_FROM_LIST (MainArrow, arrowList, acc, account);
XtRemoveCallback (arrowData->arrowb, XmNactivateCallback, XtRemoveCallback (arrowData->arrowb, XmNactivateCallback,
expandListCB, (XtPointer *) arrowData); expandListCB, (XtPointer *) arrowData);

View File

@ -87,6 +87,7 @@ recnRefresh (Account *acc)
RecnWindow *recnData; RecnWindow *recnData;
FIND_IN_LIST (RecnWindow, recnList, acc, acc, recnData); FIND_IN_LIST (RecnWindow, recnList, acc, acc, recnData);
if (!recnData) return;
/* NOTE: an improvement of the current design would be to use the /* NOTE: an improvement of the current design would be to use the
* user-data in the rows to detect where transactions need * user-data in the rows to detect where transactions need
@ -758,6 +759,7 @@ recnWindow( Widget parent, Account *acc )
} }
/********************************************************************\ /********************************************************************\
* Don't delete any structures -- the close callback will handle this *
\********************************************************************/ \********************************************************************/
void void
@ -765,9 +767,9 @@ xaccDestroyRecnWindow (Account *acc)
{ {
RecnWindow *recnData; RecnWindow *recnData;
REMOVE_FROM_LIST (RecnWindow, recnList, acc, acc, recnData); FIND_IN_LIST (RecnWindow, recnList, acc, acc, recnData);
if (!recnData) return;
XtDestroyWidget (recnData->dialog); XtDestroyWidget (recnData->dialog);
free (recnData);
} }
/********************************************************************\ /********************************************************************\
@ -786,7 +788,7 @@ recnClose( Widget mw, XtPointer cd, XtPointer cb )
RecnWindow *recnData = (RecnWindow *)cd; RecnWindow *recnData = (RecnWindow *)cd;
Account *acc = recnData->acc; Account *acc = recnData->acc;
REMOVE_FROM_LIST (RecnWindow, recnList, acc, acc, recnData); REMOVE_FROM_LIST (RecnWindow, recnList, acc, acc);
free(recnData); free(recnData);
DEBUG("closed RecnWindow"); DEBUG("closed RecnWindow");