[Gambas-devel] [WORKAROUND] BUG: gb2 & gb3 Failure to terminate

Kadaitcha Man nospam.nospam.nospam at ...176...
Fri Dec 11 23:44:58 CET 2009


2009/12/12 Kadaitcha Man <nospam.nospam.nospam at ...176...>:
> This one has had me banging my head against a brick wall.
>
> If the NEW keyword is used to instantiate a form in Sub Main() and the
> form is never displayed then the application does not terminate.
> Attached are two samples showing the same problem in both gb2 and gb3.

> This one has had me banging my head against a brick wall.
>
> If the NEW keyword is used to instantiate a form in Sub Main() and the
> form is never displayed then the application does not terminate.
> Attached are two samples showing the same problem in both gb2 and gb3.
>
> It is reasonable to create a form instance in anticipation of certain
> conditions then to decide not to show the form and instead have the
> application terminate immediately if certain conditions are or are not
> met.

To workaround this issue, do not instantiate the form with the NEW
keyword until it is known that the form will be shown. For example:

Public Sub Main()

  Dim fMain As Form
  Dim bOkToStart As Boolean

  bOkToStart = CheckOkToStart()

  If bOkToStart Then
    fMain = New fSomeForm
    fMain.Show
  Endif

End

Again, the above workaround applies to both gb2 and gb3.




More information about the Devel mailing list