Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interacting with dropdowns spills a lot of gtk-criticals in the console #80

Open
MichaelSchloesser opened this issue Feb 10, 2024 · 3 comments
Labels
Acknowledged We are aware of this issue and will respond soon Bug Non-terminating Error GTK Issue is with GTK, GDK, or GLib

Comments

@MichaelSchloesser
Copy link

MichaelSchloesser commented Feb 10, 2024

Running the code snippet below (on Ubuntu or Window 10) and interacting with the dropdowns results in a lot of Gtk-criticals messages like:

(julia:8820): Gtk-CRITICAL **: 13:15:58.498: gtk_list_item_set_child: assertion 'child == NULL || gtk_widget_get_parent (child) == NULL' failed
main() do app::Application
    window = Window(app)

    dropdown_1 = DropDown()
    item_01_id = push_back!(dropdown_1, "Item #01")
    item_02_id = push_back!(dropdown_1, "Item #02")
    item_03_id = push_back!(dropdown_1, "Item #03")

    dropdown_2 = DropDown()
    item_04_id = push_back!(dropdown_2, "Item #04")
    item_05_id = push_back!(dropdown_2, "Item #05")
    item_06_id = push_back!(dropdown_2, "Item #06")

    box = vbox(dropdown_1, dropdown_2)
    set_spacing!(box, 10)
    set_margin!(box, 10)

    set_child!(window, box)

    present!(window)
end

Addtionally on Ubuntu the window opening when clicking a dropdown behaves as desribed in #79 and sometimes appears behind the main window making it impossible to further interact with it.

This may be related to this.

@Clemapfel Clemapfel added the Acknowledged We are aware of this issue and will respond soon label Feb 11, 2024
@Clemapfel
Copy link
Owner

Clemapfel commented Feb 11, 2024

I can reproduce the warnings, MWE:

using Mousetrap
main() do app::Application
    window = Window(app)
    dropdown = DropDown()
    push_back!(dropdown, "Test")
    push_back!(dropdown, "Test") 
    set_child!(window, dropdown)
    present!(window)
end

I will investigate what could be causing this, I think it is most likely something in the C++ component

@Clemapfel
Copy link
Owner

I can't reproduce the window issue but I have an ubuntu machine to try it there

@Clemapfel Clemapfel added Bug Non-terminating Error GTK Issue is with GTK, GDK, or GLib labels Feb 11, 2024
@HyperSphereStudio
Copy link

Error messages seemed to be fixed when I wrapped the widgets in a check to see if the parent has been assigned or not. I suppose that this means the method is being called more than once?

    {
        auto* item = GTK_LIST_ITEM(object);
        auto* dropdown_item = detail::G_DROP_DOWN_ITEM(gtk_list_item_get_item(item));
		if(gtk_widget_get_parent(dropdown_item->list_widget) == NULL)
			gtk_list_item_set_child(item, dropdown_item->list_widget);
    }

    void DropDown::on_list_factory_teardown(GtkSignalListItemFactory* self, void* object, detail::DropDownInternal* internal)
    {
        // noop
    }

    void DropDown::on_label_factory_bind(GtkSignalListItemFactory* self, void* object, detail::DropDownInternal* internal)
    {
        auto* item = GTK_LIST_ITEM(object);
        auto* dropdown_item = detail::G_DROP_DOWN_ITEM(gtk_list_item_get_item(item));
		if(gtk_widget_get_parent(dropdown_item->label_widget) == NULL)
			gtk_list_item_set_child(item, dropdown_item->label_widget);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Acknowledged We are aware of this issue and will respond soon Bug Non-terminating Error GTK Issue is with GTK, GDK, or GLib
Projects
None yet
Development

No branches or pull requests

3 participants