| 
 Q: I have a dialog that I create using
         GetNewDialog, passing in a pointer to thedStorageparameter so that I can control the
         memory used by the dialog. When I close the dialog, I follow
         the guidelines in
         Inside
         Macintosh and callCloseDialograther thanDisposeDialog. However, if my dialog has an'ictb'resource associated with it, I find thatCloseDialogfails to dispose of the Dialog
         Manager's copy of the'ictb', and my
         application leaks. What should I do? A: There are a number of things that you can do to solve
         this problem. The best solution is to simply pass
         nilto thedStorageparameter ofGetNewDialog(and dispose of your dialog by
         callingDisposeDialog). This will avoid the
         memory leak (DisposeDialogdoes dispose of the
         Dialog Manager's copy of your'ictb') and, as
         an added bonus, will make your application easier to port to
         Carbon. Under Carbon, it is required that you let the
         toolbox allocate storage for your windows and dialog by
         passingnilto the storage parameter of the
         creation routines. Alternatively, you can replace your 'ictb'resource with the more modern'dftb'resource,
         which supports most of the useful functionality of an'ictb'and will not suffer from this bug. The worst solution we can think of is to plug the memory
         leak with the following code: 
            
               | static void MyCloseDialog(DialogRef dlg)
{
    AuxWinHandle auxWH;
    Handle ictbH;
 
    ictbH = nil;
    if ( GetAuxWin(dlg, &auxWH) ) {
        ictbH = (**auxWH).reserved;
    }
    CloseDialog(dlg);
    if (ictbH != nil) {
        DisposeHandle(ictbH);
    }
} |  
 Since many applications in use today assume that
         CloseDialogdoes not dispose of the dialog's'ictb'data, there is no plan for changing this
         behavior. [Jan 18 2000] |