changing a combo's popdown strings from select-list callback?



I can stimulate a segmentation violation if I change the popdown strings of
a GtkCombo while it is popped up.  This simple Python script is sufficient
to generate a core file:

    #!/usr/bin/env python

    import gtk

    recursive = 0
    def fill_new(l, item, combo):
        global recursive
        if not recursive:
            recursive = 1
            combo.set_popdown_strings(["a","b","c"])

    def main():
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_title("Today's Menu - Pick an Entree")
        window.connect("destroy", gtk.mainquit)

        combo = gtk.Combo()
        combo.set_popdown_strings(["Spam", "Eggs", "Ham"])
        combo.entry.set_text("pick an entree")
        combo.list.connect("select-child", fill_new, combo)
        window.add(combo)

        window.show_all()

        gtk.mainloop()

    if __name__ == "__main__":
        main()

How do I work around that?  Presumably, I need to wait until the Combo has
popped down (and no longer has a pointer grab?) to change its popdown
strings.

(I'm using the CVS version of Gtk+, but I doubt it matters.)

Thx,

-- 
Skip Montanaro (skip pobox com)
http://www.mojam.com/
http://www.musi-cal.com/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]