GTK(CRITICAL):IA_gtk_widget_destroy:assertion 'GTK_IS_WIDGET

Linux specific forum
gerd
User
User
Posts: 94
Joined: Tue Feb 23, 2010 7:50 pm
Location: Germany

GTK(CRITICAL):IA_gtk_widget_destroy:assertion 'GTK_IS_WIDGET

Post by gerd »

Hi,

I have a question. Why is it, that the following code under Linux causes the warning shown below the code?

Code: Select all

ForEach MenuList()
  If MenuList()\type = #Type_Menu
    If IsMenu(MenuList()\id)
      FreeMenu(MenuList()\id)    ; < This line is marked as causing the warning
    EndIf
  EndIf
Next
The warning is: GTK(CRITICAL):IA_gtk_widget_destroy:assertion 'GTK_IS_WIDGET(widget)' failed

I would have expected, that either it is a valid menu, then it can be freed or it is not, then the line with FreeMenu is never executed. In both cases there shouldn't be a warning.

Where am I wrong?

Thanks for any light on this.

gerd

BTW the same code is running under Windows without any problem.
gerd
User
User
Posts: 94
Joined: Tue Feb 23, 2010 7:50 pm
Location: Germany

Re: GTK(CRITICAL):IA_gtk_widget_destroy:assertion 'GTK_IS_WI

Post by gerd »

May be this helps to get me an answer.

The following code shows a different behaviour under Windows and Linux.
Linux: After hitting the button "Delete menu entry" the Debugger outputs
Menu 0 is valid!
Menu 0 is deleted!
and below the code section in the error log
GTK(CRITICAL):IA_gtk_widget_destroy:assertion 'GTK_IS_WIDGET(widget)' failed

Windows: The output after hitting the button "Delete menu entry"
Menu 0 is invalid! > This is what I expected also under Linux

Code: Select all

If OpenWindow(0, 200, 200, 200, 100, "Menu Example")
  ButtonGadget(0, 20, 30, 160, 25, "Delete menu entry")
  
  OpenWindow(1, 300, 300, 200, 100, "Menu Example 2")

   If CreateMenu(0, WindowID(0))
     MenuTitle("Project")
     MenuItem(1, "Test")
   EndIf

   Repeat
     Select WaitWindowEvent()
       Case #PB_Event_CloseWindow
         Break
       Case #PB_Event_Gadget
         If EventGadget() = 0 And EventType() = #PB_EventType_LeftClick
           CloseWindow(0)
           If IsMenu(0)
             Debug "Menu 0 is valid!"
             FreeMenu(0)
             Debug "Menu 0 is deleted!"
           Else
             Debug "Menu 0 is invalid!"
           EndIf
         EndIf
     EndSelect
   ForEver
EndIf
A different behaviour of the exact same code like this makes it difficult for cross platform development.
Therefore I would like to know, if there is a reason behind it.

PB 5.21, Windows 7 x64, openSUSE 13.1 x64

Thanks

gerd
Post Reply