Reopen window throws Gtk-CRITICAL **: gtk_widget_get_window: assertion 'GTK_IS_WIDGET (widget)' failed

后端 未结 1 1250
攒了一身酷
攒了一身酷 2021-01-27 05:34

I have simple python3 + gtk3 code, which connects to dbus and listen for all events. When user click on icon in tray, he must see window with all showed earlier events. Code(I d

相关标签:
1条回答
  • 2021-01-27 05:51

    Lesson 1: Never assume bugs are unrelated

    Lesson 2: GTK events are confusing.

    The reason you get this error is because the window is actually deleted in you close it in step 3, therefor all the widgets in the window become orphans (they have no parent) and are therefor cleaned. The second time you open the window in step 4 the window only contains references to deleted widgets causing your segmentation fault.

    The solution is surprisingly simple just add return True to closeWindow this will let GTK know the event has been handle and that it should not perform the default action of closing the window (that you already hide).

    0 讨论(0)
提交回复
热议问题