[GRASS-dev] [GRASS GIS] #3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkSpinButton

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
-------------------------+-------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: svn-trunk
Keywords: wxGUI | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
The terminal gets flooded with such warnings (I am using wxGTK3-3.0.3 on
Fedora).

To reproduce:
{{{
d.vect --ui
## switch to "Line" tab
(forms.py:5716): Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion
'size >= 0' failed in GtkSpinButton
(forms.py:5716): Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion
'size >= 0' failed in GtkSpinButton
...
}}}

Related comment:

On Wed, May 17, 2017 at 3:18 AM, <bugzilla@redhat.com> wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1411165
>
> --- Comment #15 from Scott Talbert ---
>> (wxgui.py:4072): Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion
'size >= 0' failed in !GtkCheckButton
>
> The latter one is likely that there isn't enough space allocated for a
check
> button widget - most likely has to be fixed in GRASS.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

Any idea which checkbox is causing that?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by neteler):

Replying to [comment:1 annakrat]:
> Any idea which checkbox is causing that?

When moving the mouse over the "width" widget, a lot of warnings appear in
the terminal.

The same, when opening the width_column dropdown.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

I'm also getting a lot of these messages, but the amount depends on the
size I allow for the GUI window of d.vect or d.rast. Using a tabbed window
manager, I get many of such messages when I add the GUI windows next to
many existing windows. However, when I provide a +/- full screen for the
GUI window, I get only very few such messages.

I can confirm that the width widgets in the Line tab cause a lot of these
messages. The same goes for the label_size widget in the Labels tab.

When launching the d.rast GUI window in tabbed window mode, I get a lot of
these messages:

{{{
gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkNotebook
}}}

I get quite a lot of these messages also when I launch d.vect --ui, but
with tabs on top, not on the left.

In short: it seems that this really depends on window layout, which it
shouldn't. Whatever the window layout, we shouldn't see our terminals
flooded with such messages. Is there any way of making this more robust ?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

Replying to [comment:1 annakrat]:
> Any idea which checkbox is causing that?

Picking up on this and on the redhat bugzilla link in the OP: after some
tests, it seems to me that it is the "Render" checkbox in the bottom right
hand corner of the g.gui Map Display or of the d.mon window that causes
this message. In the default size, both in English and even more so in
French the label of the checkbox is too long and cannot be displayed
entirely. If I enlargen the window to the point where the entire label is
displayed I do not get any of these error messages.

Would it be an idea to move this checkbox to more of a central position,
to the left of the drop down menu (which BTW is also too narrow to
accommodate the entire label text) ?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

Replying to [comment:7 mlennert]:
> Replying to [comment:1 annakrat]:
> > Any idea which checkbox is causing that?
>
> Picking up on this and on the redhat bugzilla link in the OP: after some
tests, it seems to me that it is the "Render" checkbox in the bottom right
hand corner of the g.gui Map Display or of the d.mon window that causes
this message. In the default size, both in English and even more so in
French the label of the checkbox is too long and cannot be displayed
entirely. If I enlargen the window to the point where the entire label is
displayed I do not get any of these error messages.

Just to confirm, not displaying the Render checkbox by commenting the part
as shown below makes the "gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkCheckButton" errors go away.

{{{
Index: gui/wxpython/mapdisp/frame.py

--- gui/wxpython/mapdisp/frame.py (révision 72717)
+++ gui/wxpython/mapdisp/frame.py (copie de travail)
@@ -230,8 +230,8 @@
              self.statusbarItems, mapframe=self, statusbar=statusbar)
          self.statusbarManager.AddStatusbarItem(
              sb.SbMask(self, statusbar=statusbar, position=2))
- sbRender = sb.SbRender(self, statusbar=statusbar, position=3)
- self.statusbarManager.AddStatusbarItem(sbRender)
+ #sbRender = sb.SbRender(self, statusbar=statusbar, position=3)
+ #self.statusbarManager.AddStatusbarItem(sbRender)

          self.statusbarManager.Update()

}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by ychemin):

Similar yet different problem here: I tried Moritz sbRender trick, and it
did not have any effect.

I am tempted to hide the warnings by this trick, but this is not treating
the cause of the problem...

https://stackoverflow.com/questions/3424774/how-to-suppress-gtk-warnings-
from-a-wxwidgets-wxpython-application

Here are a tiny sample of the Warnings.

{{{
(wxgui.py:4275): Gtk-WARNING **: 22:38:45.307: gtk_widget_size_allocate():
attempt to underallocate wxPizza's child GtkNotebook 0x55d4d0a42b40.
Allocation is 749x183, but minimum required size is 829x183.

(wxgui.py:4275): Gtk-CRITICAL **: 22:38:45.308: gtk_box_gadget_distribute:
assertion 'size >= 0' failed in GtkNotebook

(wxgui.py:4275): Gtk-WARNING **: 22:38:45.324: gtk_widget_size_allocate():
attempt to underallocate wxPizza's child GtkNotebook 0x55d4d0a42b40.
Allocation is 749x183, but minimum required size is 829x183.

(wxgui.py:4275): Gtk-CRITICAL **: 22:38:45.324: gtk_box_gadget_distribute:
assertion 'size >= 0' failed in GtkNotebook
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:9&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

Replying to [comment:9 ychemin]:
> Similar yet different problem here: I tried Moritz sbRender trick, and
it did not have any effect.

One difficulty here is that whether you see any of these error messages
can also depend on your locale. The Render checkbox in the Map Display
does not cause any messages when I set the language in the GUI preferences
to 'en', but I get tons of messages when I use my system locale, French.
In French, the text of the render checkbox goes beyond the edge of the Map
Display.

This means sizes have to be defined flexibly in order to accommodate
translations. No idea how hard that is.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:10&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by ychemin):

Found a generic Linux solution here:

https://askubuntu.com/questions/505594/how-to-stop-gedit-and-other-
programs-from-outputting-gtk-warnings-and-the-like

in .bashrc:

_supress() {
   eval "$1() { \$(which $1) \"\$@\" 2>&1 | tr -d '\r' | grep -v \"$2\"; }"
}

_supress grass75 "Notebook"

_supress grass75 "wxPizza"

_supress grass75 "gtk_widget"

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:11&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by ychemin):

Some more details from this thread:
https://trac.wxwidgets.org/ticket/17585
This is a similar (identical?) issue.. gtk+3.20 and wxGTK3.20

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:12&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.4.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by neteler):

* milestone: 7.2.4 => 7.4.5

Comment:

Super boring terminal "spam" still there...

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:13&gt;
GRASS GIS <https://grass.osgeo.org>

#3348: wxGTK3: Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkSpinButton
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.4
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by arjan):

* milestone: 7.4.5 => 7.8.4

Comment:

Still seeing this with v7.8.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3348#comment:14&gt;
GRASS GIS <https://grass.osgeo.org>