pyface icon indicating copy to clipboard operation
pyface copied to clipboard

ApplicationWindow isn't cleaning up StatusBarManager

Open ievacerny opened this issue 4 years ago • 1 comments

Qt ApplicationWindow tests are leaking QStatusBar:

ApplicationWindow tests output
QObjects at start of test run: {'QApplication': 2}.
[Wed Jun 10 22:41:07 2020] ( 1/16) test_activate (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:07 2020] ( 2/16) test_close (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:08 2020] ( 3/16) test_icon (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:08 2020] ( 4/16) test_menubar (pyface.tests.test_application_window.TestApplicationWindow) ... ok
test_menubar (pyface.tests.test_application_window.TestApplicationWindow) changed QObject counts. added: {'QAction': 5}.
[Wed Jun 10 22:41:08 2020] ( 5/16) test_open_close (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:08 2020] ( 6/16) test_position (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:09 2020] ( 7/16) test_reposition (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:09 2020] ( 8/16) test_resize (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:09 2020] ( 9/16) test_retitle (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:09 2020] (10/16) test_show (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:09 2020] (11/16) test_size (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:10 2020] (12/16) test_statusbar (pyface.tests.test_application_window.TestApplicationWindow) ... ok
test_statusbar (pyface.tests.test_application_window.TestApplicationWindow) changed QObject counts. added: {'QStatusBar': 1}.
[Wed Jun 10 22:41:10 2020] (13/16) test_statusbar_changed (pyface.tests.test_application_window.TestApplicationWindow) ... ok
test_statusbar_changed (pyface.tests.test_application_window.TestApplicationWindow) changed QObject counts. added: {'QStatusBar': 1}.
[Wed Jun 10 22:41:10 2020] (14/16) test_title (pyface.tests.test_application_window.TestApplicationWindow) ... ok
[Wed Jun 10 22:41:10 2020] (15/16) test_toolbar (pyface.tests.test_application_window.TestApplicationWindow) ... ok
test_toolbar (pyface.tests.test_application_window.TestApplicationWindow) changed QObject counts. added: {'QAction': 5, '_ToolBar': 1}.
[Wed Jun 10 22:41:10 2020] (16/16) test_toolbar_changed (pyface.tests.test_application_window.TestApplicationWindow) ... ok
test_toolbar_changed (pyface.tests.test_application_window.TestApplicationWindow) changed QObject counts. added: {'QAction': 5, '_ToolBar': 1}.
QObjects at end of test run: {'QApplication': 2, 'QAction': 15, 'QStatusBar': 2, '_ToolBar': 2}.

In MApplicationWindow, MenuBarManager and ToolBarManager are destroyed but not StatusBarManager. This can be done via destroy_status_bar (qt) or remove_status_bar (wx).

The first step would probably be bringing qt and wx interfaces together and then simply adding a couple lines of code to MApplicationWindow.

ievacerny avatar Jun 11 '20 09:06 ievacerny

I was debugging an entire day now to find out why my GUI tests in pytest are crashing, until I found out that StatusBarManager is not properly recycled. Then I found this issue :D I'll fix this and add a PR now

johannesloibl avatar Jul 01 '22 14:07 johannesloibl