Problem: 1666900

Title: (ACS) CDialog_AC::GetNewDialog() & CStaticText_AC::DrawObject

Received: Jul 7 1997 3:02PM


I've been testing with ACS bc 4 and have found two new bugs:

CDialog_AC::GetNewDialog() - The code doesn't check if the fDialogPtr is null after calling GetNewDialog() and eventually calls MoveWindow() - which crashes if the DLOG or DITL resource is not found.

CStaticText_AC::DrawObject - The current text is not erased. DrawObject() makes a call to AGATextBox() which calls TextBox_AC(). TextBox_AC() has a parameter to erase first but AGATextBox() uses the default which is false. Therefore it just overwrites the current text leaving a mess on the screen.


Fix: fDialogPtr is widely used without checking. Maybe we should put assert in code to make sure it is non-null. For the second problem, I saw the comment in code

Added ThrowIfNULL_AC calls to CDialog_AC.cp in two places after calls that set fDialogPtr. Developer may verify that this fix is sufficient for his needs.

Added fEraseFirst bool parameter to CStaticText_AC (in .h and .cp), which TStaticText sets and which is passed to TextBox_AC. Client may then set fEraseFirst to kEraseFirst and the view will erase. Changed CDialog_AC.cp's creation of CStaticText_AC to automatically set to kEraseFirst, so this happens automatically for dialogs (not automatic for TStaticText in MacApp, because colors may not be gray).