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



Hi Skip, I don't know if this is still true for 1.3, but with gtk 1.2 you got a core if you removed the item with focus from a popup list. I worked around this by doing a gtk_widget_grab_focus() somewhere else before doing the delete.

John

Skip Montanaro wrote:

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.)





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