https://bugs.kde.org/show_bug.cgi?id=439137

--- Comment #13 from qydwhotm...@gmail.com ---
I studied the source code of gtk-demo, and found the bug may exist in the demo
program.

1. In main.c, gtk_demo_run() is called when "Run" button is pressed.
(https://gitlab.gnome.org/GNOME/gtk/-/blob/master/demos/gtk-demo/main.c#L267)

2, In gtk_demo_run(), "self->func (window)" is called BEFORE
gtk_window_set_transient_for() is called which sets the transient property.
(https://gitlab.gnome.org/GNOME/gtk/-/blob/master/demos/gtk-demo/main.c#L155)

3. With regard to "self->func (window)", "window" refers to the parent window,
and "func" refers to "do_dialog" in dialog.c

4. do_dialog() calls gtk_widget_show() after attributes of the widget are set.
(https://gitlab.gnome.org/GNOME/gtk/-/blob/master/demos/gtk-demo/dialog.c#L187)


That should explain the race condition. do_dialog() is called before
gtk_window_set_transient_for(), and I don't know why they intend to do that.
But in message_dialog_clicked(), gtk_window_set_transient_for() called by
gtk_message_dialog_new() is called before gtk_widget_show().
(https://gitlab.gnome.org/GNOME/gtk/-/blob/master/demos/gtk-demo/dialog.c#L22)
(https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gtk/gtkmessagedialog.c#L532)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to