Gtk (CRITICAL) ERRORS ???

Linux specific forum
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Gtk (CRITICAL) ERRORS ???

Post by Joris »

Hi,

The source below is a small sample which works well, but is very comparable to my bigger one which does get errors.
Can anyone tell me what can be the reason for those errors or how to solve this ?
Point is creating a complete gadget setup at runtime.

Thanks

Code: Select all

Global.i Window_0,Canvas_0, btn1, a, b,x,y,w,h
Window_0 = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, 500,500, "test ", #PB_Window_SystemMenu |#PB_Window_ScreenCentered |#PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
Canvas_0 = CanvasGadget(#PB_Any,0, 0, 500,500,  #PB_Canvas_Keyboard | #PB_Canvas_Container)  
btn1=ButtonGadget(#PB_Any, 430,10, 50,20, "testing")	
For a=0 To 5
  ButtonGadget(#PB_Any, 10,10 + (a*25), 40,20, "testing")	
Next a
x=80
y=10
w=40
h=20
Repeat 
  EventID = WaitWindowEvent() 
  If EventID = #PB_Event_CloseWindow 
      End
  ElseIf EventID = #PB_Event_Gadget 
      If EventGadget()=btn1
         For a=0 To 5
            ButtonGadget(#PB_Any, x+b,y + (a*25),w,h, "testing",#PB_Button_Right)	
          Next   
           b+70
      EndIf
  EndIf 
ForEver 
This is the part on which the errors occur, as they were selected for creating the gadgets, in the bigger complete source. But I don't know why.

Code: Select all

  Select \type
(Line: 1194) => Case #PB_GadgetType_Button        : \idx = ButtonGadget(#PB_Any, \x,\y,\w,\h, txt, \flag)	      ;1 
(Line: 1199) => Case #PB_GadgetType_CheckBox      : \idx = CheckBoxGadget(#PB_Any, \x,\y,\w,\h, txt, \flag)     ;4 
10:40:34] [WARNING] mysource.pb (Line: 1194)
[10:40:34] [WARNING] Gtk (CRITICAL): gtk_layout_put: assertion 'GTK_IS_LAYOUT (layout)' failed
[10:40:34] [WARNING] mysource.pb (Line: 1194)
[10:40:34] [WARNING] Gtk (CRITICAL): gtk_widget_realize: assertion 'widget->priv->anchored || GTK_IS_INVISIBLE (widget)' failed
[10:40:53] [WARNING] mysource.pb (Line: 1199)
[10:40:53] [WARNING] Gtk (CRITICAL): gtk_layout_put: assertion 'GTK_IS_LAYOUT (layout)' failed
[10:40:53] [WARNING] mysource.pb (Line: 1199)
[10:40:53] [WARNING] Gtk (CRITICAL): gtk_widget_realize: assertion 'widget->priv->anchored || GTK_IS_INVISIBLE (widget)' failed
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Fips
User
User
Posts: 28
Joined: Sun Feb 20, 2022 1:03 pm

Re: Gtk (CRITICAL) ERRORS ???

Post by Fips »

Hi,

are you using UseGadgetList() ? I was having pretty much the same warnings recently when i forgot to use WindowID() with UseGadgetList().

Would be useful to post a code snippet which actually causes the errors.

Fips
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: Gtk (CRITICAL) ERRORS ???

Post by Joris »

Hi,

Yes I use somewhere UseGadgetList(), but one time for a gadget-setup (see code below).
I have multiple use of OpenGadgetList(hnd) and CloseGadgetList(), but that works ok under windows
and should be ok on linux too, as those need to be used in pair each time otherwhise you get wrong gadget-setups.
The only thing I'm in doubt, is about the Canvas created at the start with the flag #PB_Canvas_Container.
I think this is equal to the OpenGadgetList(hnd) and so a second call of OpenGadgetList(hnd) migth not be needed before first CloseGadgetList(). Otherwhise I need to, remove the flag and only use OpenGadgetList(hnd) and CloseGadgetList().
I must/will try this later (today or) ...

Thanks.

Code: Select all

Procedure Bereken_Teksthoogte(whnd.i)  
  Protected.i btn_tmp, h.i 
  
  UseGadgetList(WindowID(whnd))
  btn_tmp=ButtonGadget(#PB_Any, 0,0,1,1, "") 
  SetGadgetText(btn_tmp, "tg")   
  ResizeGadget(btn_tmp, #PB_Ignore, #PB_Ignore, #PB_Ignore, GadgetHeight(btn_tmp, #PB_Gadget_RequiredSize))
  h=GadgetHeight(btn_tmp,#PB_Gadget_ActualSize) / 2   
  FreeGadget(btn_tmp)
  ProcedureReturn h
  
EndProcedure 
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: Gtk (CRITICAL) ERRORS ???

Post by Joris »

Hi,

(Problem exist on Ubuntu, not under windows.)
I think I have isolated the problem, in the code below, of not being able to draw the gadgets.
OpenGadgetList(hnd) and CloseGadgetList() combined with the flag #PB_Canvas_Container.
Yet why is still not clear to me.

If the #PB_Canvas_Container is not set only CloseGadgetList() gives problems, OpenGadgetList(hnd) doesn't.
If the #PB_Canvas_Container is set OpenGadgetList(hnd) and CloseGadgetList() gives problems. No gadgets are drawn.
So the sollution looks more like, add gadgets at runtime : change the flag #PB_Canvas_Container.
What else if adding gadgets at runtime to more then one canvas ?


To me there is something wrong in the order of using these three.
Can anyone clarify this

Thanks

Code: Select all

;******************************************************** 
;{******************************************************** 
Structure Gadget_Set
  x.w                                                                                             
  y.w                                                                                             
  w.w                                                                                             
  h.w   
  fcolor.a    ;kleur nr fill dot-kader
  bcolor.a    ;kleur nr achtergrond  
  mark.a      ;runtime markering voor delete oid.
  prnt.u      ;list index van het parent Gadget gebruik nog verder invoeren (zie ook uitleg bovenaan)
  type.u      ;Gadget type constante
  atrb.l      ;Gadget flag specifikaties binair ingevoegd MAAR op volgorde van de tekst-lijst met Flags
  flag.i      ;som van alle Flag-specifikaties decimale vorm     INTEGERS ACHTERAAN PLAATSEN
  idx.i
EndStructure
Structure Save_Ob
 name.i      ;som van alle specifikaties decimale vorm     INTEGERS ACHTERAAN PLAATSEN
 spec.i
 typ.u
EndStructure
Structure wXYWH  ;OPGELET NIEUW FORMAAT ALLES ALS WORD I.P.V. LONG
  x.w            ;door 2-bytes Word ipv Unicode gebruik kunnen ook negatieve waarde gebruikt worden
  y.w            ;nuttig bij rubberdrawbox met "negatieve muisbewegingen" !
  w.w
  h.w
EndStructure
;******************************************************* 
Global NewList Ob.Gadget_Set() 
Global NewList xy.wXYWH() 
Global result.s, text.s, pad.s, userpad.s, S_flag.s, Ob_Edit.Gadget_Set, SOb.Save_Ob, btn_info 
Global.i Window_0,Canvas_0, btn1, a, b,x,y,w,h,btn1, btn2
;}********************************************************
;********************************************************
Procedure  AddGadgetSample(spec.i)
      
      If spec    
             Debug "tweede"
          AddElement(Ob()) : Ob()\x= 95 : Ob()\y= 80 : Ob()\w=90 : Ob()\h=40 :  Ob()\type = #PB_GadgetType_Button                
          AddElement(Ob()) : Ob()\x=207 : Ob()\y= 80 : Ob()\w=90 : Ob()\h=40 :  Ob()\type = #PB_GadgetType_Button                
          AddElement(Ob()) : Ob()\x= 95 : Ob()\y=132 : Ob()\w=90 : Ob()\h=40 :  Ob()\type = #PB_GadgetType_Button                 
          AddElement(Ob()) : Ob()\x=207 : Ob()\y=132 : Ob()\w=90 : Ob()\h=40 :  Ob()\type = #PB_GadgetType_Button                 
          
          AddElement(Ob()) : Ob()\x=335 : Ob()\y=210 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_CheckBox                 
          AddElement(Ob()) : Ob()\x=397 : Ob()\y=210 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_CheckBox                 
          AddElement(Ob()) : Ob()\x=335 : Ob()\y=245 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_CheckBox                 
          AddElement(Ob()) : Ob()\x=397 : Ob()\y=245 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_CheckBox           
          
          AddElement(Ob()) : Ob()\x=335 : Ob()\y=280 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_Option                 
          AddElement(Ob()) : Ob()\x=397 : Ob()\y=280 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_Option                  
          AddElement(Ob()) : Ob()\x=335 : Ob()\y=315 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_Option                  
          AddElement(Ob()) : Ob()\x=397 : Ob()\y=315 : Ob()\w=55 : Ob()\h=30 :  Ob()\type =#PB_GadgetType_Option                  
      Else
          Debug "eerste"
          AddElement(xy()) : xy()\x= 95+200 : xy()\y= 80 : xy()\w=90 : xy()\h=40 
          AddElement(xy()) : xy()\x=207+200 : xy()\y= 80 : xy()\w=90 : xy()\h=40 
          AddElement(xy()) : xy()\x= 95+200 : xy()\y=132 : xy()\w=90 : xy()\h=40 
          AddElement(xy()) : xy()\x=207+200 : xy()\y=132 : xy()\w=90 : xy()\h=40 
          
          AddElement(xy()) : xy()\x=535 : xy()\y=210 : xy()\w=55 : xy()\h=30 
          AddElement(xy()) : xy()\x=597 : xy()\y=210 : xy()\w=55 : xy()\h=30 
          AddElement(xy()) : xy()\x=535 : xy()\y=245 : xy()\w=55 : xy()\h=30 
          AddElement(xy()) : xy()\x=597 : xy()\y=245 : xy()\w=55 : xy()\h=30 
          
          AddElement(xy()) : xy()\x=535 : xy()\y=280 : xy()\w=55 : xy()\h=30 
          AddElement(xy()) : xy()\x=597 : xy()\y=280 : xy()\w=55 : xy()\h=30 
          AddElement(xy()) : xy()\x=535 : xy()\y=315 : xy()\w=55 : xy()\h=30 
          AddElement(xy()) : xy()\x=597 : xy()\y=315 : xy()\w=55 : xy()\h=30 
      EndIf
      
EndProcedure    
;********************************************************
Procedure Drop_Gadget_Selected(*ob.Gadget_Set, idx.i)
  Protected.i a, val1, val2, val3, last_idx, txt.s 
  
  With *ob 
  
     txt="gdt" 
    Debug Str(\type)+ " drop  "+ RSet(Str(\x),3," ") + ","+  RSet(Str(\y),3," ") + ","+  RSet(Str(\w),3," ") + ","+  RSet(Str(\h),3," ") + " "+ txt + "  flg= " +Str(\flag)
      
    Select \type
      Case #PB_GadgetType_Button        : \idx = ButtonGadget(#PB_Any, \x,\y,\w,\h, txt, \flag)	      ;1 
      Case #PB_GadgetType_ButtonImage   : \idx = ButtonImageGadget(#PB_Any, \x,\y,\w,\h, val1, \flag) ;19
      Case #PB_GadgetType_Calendar      : \idx = CalendarGadget(#PB_Any, \x,\y,\w,\h, val1, \flag)    ;20
      Case #PB_GadgetType_Canvas        :; \idx = CanvasGadget(#PB_Any, \x,\y,\w,\h, \flag)           ;33
      Case #PB_GadgetType_CheckBox      : \idx = CheckBoxGadget(#PB_Any, \x,\y,\w,\h, txt, \flag)     ;4 
      Case #PB_GadgetType_ComboBox      : \idx = ComboBoxGadget(#PB_Any, \x,\y,\w,\h, \flag)          ;8 
      ;OPGELET CONTANER GADGETS WORDEN MET HANDLE OPGEZOCHT EN DUS INVOER MET GADGETID => SetGadgetData(\idx, GadgetID(\idx))
      Case #PB_GadgetType_Container     : \idx =ContainerGadget(#PB_Any, \x,\y,\w,\h, \flag)
      Case #PB_GadgetType_Frame         : \idx = FrameGadget(#PB_Any, \x,\y,\w,\h, txt, \flag)        ;7 
      Case #PB_GadgetType_Option        : \idx = OptionGadget(#PB_Any, \x,\y,\w,\h, txt)              ;5 
      EndSelect 
    last_idx=\idx
  EndWith
  
EndProcedure
Procedure  Add_Element(type.u, flag.i, atrb.l, prnt.u)
  
  AddElement(Ob())
  Ob()\type =#PB_GadgetType_Button ; type
  Ob()\flag = flag      
  Ob()\atrb = atrb      
  Ob()\prnt = prnt
    
EndProcedure
Procedure  Position_Added_Gadgets(hnd.i)           ;PLAATSEN VAN AT RUNTIME GETEKENDE GADGETS 
  Protected grid.i 
  Static parent_id.u
  
  OpenGadgetList(hnd)                    ;***************problem*****************
  
  With Ob_Edit
    
    ForEach xy()
      Add_Element(\type, \flag, \atrb, parent_id)  
      CopyMemory(@xy(), @Ob(), SizeOf(wXYWH))
      Drop_Gadget_Selected(Ob(), ListIndex(Ob()))  
    Next
    
  EndWith 
  
  CloseGadgetList()                         ;***************problem*****************
  
EndProcedure
Procedure Remove_All_Gadgets()
   ClearList(xy())
   ClearList(Ob())
  
EndProcedure
Procedure Window_0_Events(event)   ; GADGET PLAATSING WINDOW
  Protected.i x,y,tekst.s 
 
  Select event
     ;********************************************************  
    Case #PB_Event_CloseWindow :    End
    Case #PB_Event_SizeWindow :     ResizeGadget(Canvas_0,#PB_Ignore, #PB_Ignore, WindowWidth(Window_0), WindowHeight(Window_0)) 
    Case #PB_Event_Gadget
      ;******************************************************** 
      Select EventGadget()
        Case btn1 : 
          Remove_All_Gadgets()
          AddGadgetSample(0)
          Position_Added_Gadgets(Canvas_0)
          
        Case btn2 : 
          ;deze worden wel geplaatst  
          Remove_All_Gadgets()
          AddGadgetSample(1)
          ForEach Ob()
            Drop_Gadget_Selected(Ob(), ListIndex(Ob()))  
          Next
          
         Case Canvas_0 : 
          Select EventType()
            Case #PB_EventType_KeyDown 
            Case #PB_EventType_LeftButtonDown 
            Case #PB_EventType_MouseMove  :
           Case #PB_EventType_RightButtonDown 
                     
          EndSelect
          ;******************************************************** 
      EndSelect  
      
  EndSelect   
    
EndProcedure
;********************************************************
Procedure OpenWindow_0(x = 0, y = 0, width = 800, height = 700)
 Window_0 = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, width, height, "Testing", #PB_Window_SystemMenu |#PB_Window_ScreenCentered |#PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  Canvas_0 = CanvasGadget(#PB_Any,0, 0, width, height, #PB_Canvas_Keyboard| #PB_Canvas_Container) ; | #PB_Canvas_ClipMouse)
  btn1 = ButtonGadget(#PB_Any, 700,20,50,20, "Set 1")	      
  btn2 = ButtonGadget(#PB_Any, 700,60,50,20, "Set 2")	      
EndProcedure
Procedure Eventloop()
      
      Repeat 
        EventID = WaitWindowEvent() 
        If EventID 
            Select EventWindow() 
              Case Window_0
                Window_0_Events(EventID) 
            EndSelect 
        EndIf 
      ForEver 
  
EndProcedure
OpenWindow_0()
Eventloop()
;errors bij reuniform outpu aanmaak van nieuwe gadgets :
; [10:17:02] [WARNING] GLib-GIO (Debug): _g_io_module_get_default: Found Default implementation gvfs (GDaemonVfs) For ‘gio-vfs’
; [10:17:26] [WARNING] Gtk (CRITICAL): gtk_layout_put: assertion 'GTK_IS_LAYOUT (layout)' failed
; [10:17:26] [WARNING] Gtk (CRITICAL): gtk_widget_realize: assertion 'widget->priv->anchored || GTK_IS_INVISIBLE (widget)' failed
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Post Reply