[Gambas-user] getting warning when quitting running application

Gianluigi bagonergi at gmail.com
Thu May 12 13:52:17 CEST 2022


Il giorno gio 12 mag 2022 alle ore 12:03 Bruce Steers <bsteers4 at gmail.com>
ha scritto:

>
>
> On Thu, 12 May 2022 at 10:49, Gianluigi <bagonergi at gmail.com> wrote:
>
>>
>>
>> Il giorno gio 12 mag 2022 alle ore 11:41 Bruce Steers <bsteers4 at gmail.com>
>> ha scritto:
>>
>>>
>>>
>>> On Thu, 12 May 2022 at 10:34, Gianluigi <bagonergi at gmail.com> wrote:
>>>
>>>>
>>>>
>>>> Il giorno gio 12 mag 2022 alle ore 11:13 Bruce Steers <
>>>> bsteers4 at gmail.com> ha scritto:
>>>>
>>>>> Note. using the Windows array and .Close as I suggested exits cleanly
>>>>> with no warnings at all.
>>>>>
>>>>> Just setting Application.MainWindow = Me like Ben says does close all
>>>>> windows but I get all this on exit...
>>>>>
>>>>> (_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_reset:
>>>>> assertion 'GTK_IS_IM_CONTEXT (context)' failed
>>>>> (_aa:72471): Gtk-CRITICAL **: 10:06:51.207:
>>>>> gtk_im_context_set_client_window: assertion 'GTK_IS_IM_CONTEXT (context)'
>>>>> failed
>>>>> (_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_reset:
>>>>> assertion 'GTK_IS_IM_CONTEXT (context)' failed
>>>>> (_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_focus_out:
>>>>> assertion 'GTK_IS_IM_CONTEXT (context)' failed
>>>>> (_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_reset:
>>>>> assertion 'GTK_IS_IM_CONTEXT (context)' failed
>>>>>
>>>>> gbx3 [72471]: warning: circular references detected:
>>>>> gbx3:     1 Form1
>>>>> gbx3:     1 Spring
>>>>> gbx3 [72471]: warning: 17 allocation(s) non freed.
>>>>>
>>>>
>>>> If one uses a loop to close all windows what good is
>>>> Application.MainWindow = Me?
>>>> Application.MainWindow = Me is only needed if you close 'the window'
>>>> (one of the windows in charge of closing the application) that correctly
>>>> closes the application.
>>>>
>>>> To recap if I have only one Main window then on opening I will indicate
>>>> the main as Application.MainWindow, otherwise, if the windows assigned to
>>>> that task are more than one, my suggestion may be useful.
>>>>
>>>
>>> All suggestions for improvement are always welcome :)
>>>
>>> I'm just saying the Application.MainWindow method sounded much better
>>> than using a loop as i suggested but unfortunately it does not seem to be
>>> as clean.
>>> BruceS
>>>
>>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>>
>>
>> I probably misunderstood.
>> You should attach an example
>>
>
> I just modified a test app that makes an additional form with the loop to
> test my initial solution.
> Like i say using the Windows[] array exits clean, using
> Application.MainWindow method does not
>  (just uncomment the MainWindow allocation and comment the loop in
> Form_Close)
>
> Is it a bug in Application.MainWindow method Ben?
>
> BruceS
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>

Sorry but your code is not clear to me, try this:
[code]
Public Sub Form_Open()

  Dim hWindow As Window

  Application.MainWindow = Me
  With Me
    .Width = 420
    .Height = 420
    .Center
    .Title = "MAIN WINDOW"
  End With
  For i As Integer = 0 To 9
    With hWindow = New Window As "Form" & CStr(i + 1)
      .X = i * 50
      .Y = i * 50
      .Width = 420
      .Height = 420
      .Title = "FORM " & CStr(i + 1)
      .Show
    End With
  Next

End
[/code]

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220512/f1351053/attachment-0001.htm>


More information about the User mailing list