[glade--]bug fix for empty combo list

"Howdy Pierce" <[email protected]>
Newsgroups gmane.comp.gnome.glademm
Message-ID <[email protected]>
Hello--

I was attempting to add a Gtk::Combo widget in Glade with an empty list.
The elements in the list get added by my code after the myWindow_glade ctor
is called.  The problem with this is that glade-- generates incorrect code
in the _glade.cc file, resulting in the following runtime warning:

Gtk-CRITICAL **: file gtkcombo.c: line 954 (gtk_combo_set_popdown_strings):
assertion `strings != NULL' failed

Here is a fix for this -- it's a one-line change in src/writers/combo.cc to
ensure that the list has elements in it.

--- combo.cc.orig	2003-02-24 14:30:21.000000000 -0700
+++ combo.cc.new	2003-02-24 14:30:58.000000000 -0700
@@ -49,7 +49,7 @@
    if (Configuration.glade2)
    {  Widget::const_iterator i=w.begin();
       for (;i!=w.end() && (*i).ChildName()!="list"; ++i);
-      if (i!=w.end())
+      if (i!=w.end() && ((*i).begin() != (*i).end()))
       {  f.StartBlock().Declaration() << "const char * const items[]";
          f.Assignment() << "{ ";
          for (Widget::const_iterator j=(*i).begin();j!=(*i).end();++j)



Regards,
--Howdy

  =============================
  Howdy Pierce
  Managing Partner
  Cardinal Peak, LLC

  email: [email protected]
  work: (303) 665-3962
  cell: (303) 589-1645
  =============================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.