Warning on wxGTK - focus lost even though window didn't have it

17 views
Skip to first unread message

Igor Korot

unread,
Jun 6, 2021, 3:31:22 AM6/6/21
to wx-dev
Hi, (Paul, Vadim),
I recently updated my Linux box and with latest wxWidgets release started
seeing this:

[quote]
02:29:00: Debug: window wxDataViewListCtrl(0x555555d9b800) lost focus
even though it didn't have it
[/quote]

Trying to debug I see following backtrace:

[code]
(gdb) bt
#0 wxWindow::GTKHandleFocusOutNoDeferring (this=0x555555d9b800) at
../src/gtk/window.cpp:4532
#1 0x00007ffff77ad5d2 in wxWindow::GTKHandleFocusOut
(this=0x555555d9b800) at ../src/gtk/window.cpp:4504
#2 0x00007ffff77a521f in gtk_window_focus_out_callback
(win=0x555555d9b800) at ../src/gtk/window.cpp:2057
#3 0x00007ffff5f199e3 in _gtk_marshal_BOOLEAN__BOXED () from
/usr/lib64/libgtk-3.so.0
#4 0x00007ffff4f3330c in g_closure_invoke () from
/usr/lib64/libgobject-2.0.so.0
#5 0x00007ffff4f45b09 in signal_emit_unlocked_R.isra.0 () from
/usr/lib64/libgobject-2.0.so.0
#6 0x00007ffff4f4b81b in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#7 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#8 0x00007ffff5ec153c in gtk_widget_event_internal.part () from
/usr/lib64/libgtk-3.so.0
#9 0x00007ffff5ed39f1 in gtk_widget_send_focus_change () from
/usr/lib64/libgtk-3.so.0
#10 0x00007ffff5ed784b in do_focus_change () from /usr/lib64/libgtk-3.so.0
#11 0x00007ffff5ed7ae2 in gtk_window_real_set_focus () from
/usr/lib64/libgtk-3.so.0
#12 0x00007ffff4f36844 in g_cclosure_marshal_VOID__OBJECTv () from
/usr/lib64/libgobject-2.0.so.0
#13 0x00007ffff4f3355c in _g_closure_invoke_va () from
/usr/lib64/libgobject-2.0.so.0
#14 0x00007ffff4f4c031 in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#15 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#16 0x00007ffff5ee38c7 in _gtk_window_unset_focus_and_default () from
/usr/lib64/libgtk-3.so.0
#17 0x00007ffff5ed1726 in gtk_widget_set_child_visible () from
/usr/lib64/libgtk-3.so.0
#18 0x00007ffff5d930a3 in gtk_notebook_real_switch_page () from
/usr/lib64/libgtk-3.so.0
#19 0x00007ffff4f3330c in g_closure_invoke () from
/usr/lib64/libgobject-2.0.so.0
#20 0x00007ffff4f45330 in signal_emit_unlocked_R.isra.0 () from
/usr/lib64/libgobject-2.0.so.0
#21 0x00007ffff4f4bc7f in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#22 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#23 0x00007ffff5d9b9c4 in gtk_notebook_set_current_page () from
/usr/lib64/libgtk-3.so.0
#24 0x00007ffff78133f5 in wxNotebook::DoSetSelection
(this=0x555555a97800, page=4, flags=1) at ../src/gtk/notebook.cpp:246
#25 0x00007ffff781553e in wxNotebook::SetSelection
(this=0x555555a97800, nPage=4) at ../include/wx/gtk/notebook.h:54
#26 0x00007ffff7871a7d in wxBookCtrlBase::DoSetSelectionAfterInsertion
(this=0x555555a97800, n=4, bSelect=true)
at ../src/common/bookctrl.cpp:442
#27 0x00007ffff7814438 in wxNotebook::InsertPage (this=0x555555a97800,
position=4, win=0x5555559c5800, text=..., select=true,
imageId=-1) at ../src/gtk/notebook.cpp:486
#28 0x00007ffff7814fb7 in wxBookCtrlBase::AddPage
(this=0x555555a97800, page=0x5555559c5800, text=..., bSelect=true,
imageId=-1) at ../include/wx/bookctrl.h:184
#29 0x00007fffe59c08db in DrawingView::OnCreate (this=0x555555af2070,
doc=0x555555ae16f0, flags=3)
at /home/igor/dbhandler/libdbwindow/databaseview.cpp:259
#30 0x00007fffe59f1f9f in DatabaseTemplate::CreateDatabaseView
(this=0x5555556ea9c0, doc=0x555555ae16f0, type=QueryView,
painters=..., flags=3) at
/home/igor/dbhandler/libdbwindow/databasetemplate.cpp:65
#31 0x00007fffe59f2103 in DatabaseTemplate::CreateDatabaseDocument
(this=0x5555556ea9c0, path=..., type=QueryView,
db=0x555555a2a260, painters=..., flags=3) at
/home/igor/dbhandler/libdbwindow/databasetemplate.cpp:80
#32 0x00007fffe59e9066 in CreateDatabaseWindow (parent=0x555555716260,
docManager=0x5555556cfa00, db=0x555555a2a260,
type=QueryView, painters=...) at
/home/igor/dbhandler/libdbwindow/dbview.cpp:140
#33 0x00005555555830fb in MainFrame::OnQuery (this=0x555555716260, event=...)
at /home/igor/dbhandler/dbhandler/mainframe.cpp:433
#34 0x00007ffff726529a in wxAppConsoleBase::HandleEvent
(this=0x5555556166f0, handler=0x555555716260, func=
(void (wxEvtHandler::*)(wxEvtHandler * const, wxEvent &))
0x555555582e26 <MainFrame::OnQuery(wxCommandEvent&)>, event=...)
at ../src/common/appbase.cpp:657
#35 0x00007ffff726530e in wxAppConsoleBase::CallEventHandler
(this=0x5555556166f0, handler=0x555555716260, functor=...,
--Type <RET> for more, q to quit, c to continue without paging--
event=...) at ../src/common/appbase.cpp:669
#36 0x00007ffff7395aa2 in wxEvtHandler::ProcessEventIfMatchesId
(entry=..., handler=0x555555716260, event=...)
at ../src/common/event.cpp:1425
#37 0x00007ffff739484d in wxEventHashTable::HandleEvent
(this=0x5555555aa180 <MainFrame::sm_eventHashTable>, event=...,
self=0x555555716260) at ../src/common/event.cpp:1033
#38 0x00007ffff7395fad in wxEvtHandler::TryHereOnly
(this=0x555555716260, event=...) at ../src/common/event.cpp:1622
#39 0x00007ffff7397a39 in wxEvtHandler::TryBeforeAndHere
(this=0x555555716260, event=...) at ../include/wx/event.h:3927
#40 0x00007ffff7395db1 in wxEvtHandler::ProcessEventLocally
(this=0x555555716260, event=...) at ../src/common/event.cpp:1555
#41 0x00007ffff7395d49 in wxEvtHandler::ProcessEvent
(this=0x555555716260, event=...) at ../src/common/event.cpp:1528
#42 0x00007ffff798e53c in wxWindowBase::TryAfter (this=0x555555725fb0,
event=...) at ../src/common/wincmn.cpp:3493
#43 0x00007ffff7395d7c in wxEvtHandler::ProcessEvent
(this=0x555555725fb0, event=...) at ../src/common/event.cpp:1541
#44 0x00007ffff7396059 in wxEvtHandler::SafelyProcessEvent
(this=0x555555725fb0, event=...) at ../src/common/event.cpp:1646
#45 0x00007ffff79885b2 in wxWindowBase::HandleWindowEvent
(this=0x555555725fb0, event=...) at ../src/common/wincmn.cpp:1570
#46 0x00007ffff796fd29 in wxToolBarBase::OnLeftClick
(this=0x555555725fb0, toolid=5, toggleDown=false)
at ../src/common/tbarbase.cpp:667
#47 0x00007ffff782eed0 in item_clicked (tool=0x5555556c3700) at
../src/gtk/toolbar.cpp:82
#48 0x00007ffff4f3355c in _g_closure_invoke_va () from
/usr/lib64/libgobject-2.0.so.0
#49 0x00007ffff4f4c031 in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#50 0x00007ffff4f4c45f in g_signal_emit_by_name () from
/usr/lib64/libgobject-2.0.so.0
#51 0x00007ffff4f3355c in _g_closure_invoke_va () from
/usr/lib64/libgobject-2.0.so.0
#52 0x00007ffff4f4c031 in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#53 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#54 0x00007ffff5c4fe78 in gtk_real_button_released () from
/usr/lib64/libgtk-3.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#55 0x00007ffff4f3330c in g_closure_invoke () from
/usr/lib64/libgobject-2.0.so.0
#56 0x00007ffff4f45572 in signal_emit_unlocked_R.isra.0 () from
/usr/lib64/libgobject-2.0.so.0
#57 0x00007ffff4f4bc7f in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#58 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#59 0x00007ffff5c4dfa0 in multipress_released_cb () from
/usr/lib64/libgtk-3.so.0
#60 0x00007ffff5f200a3 in _gtk_marshal_VOID__INT_DOUBLE_DOUBLEv ()
from /usr/lib64/libgtk-3.so.0
#61 0x00007ffff4f3355c in _g_closure_invoke_va () from
/usr/lib64/libgobject-2.0.so.0
#62 0x00007ffff4f4c031 in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#63 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#64 0x00007ffff5d21ec4 in gtk_gesture_multi_press_end () from
/usr/lib64/libgtk-3.so.0
#65 0x00007ffff4f36534 in g_cclosure_marshal_VOID__BOXEDv () from
/usr/lib64/libgobject-2.0.so.0
#66 0x00007ffff4f3355c in _g_closure_invoke_va () from
/usr/lib64/libgobject-2.0.so.0
#67 0x00007ffff4f4c031 in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#68 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#69 0x00007ffff5d1ed97 in _gtk_gesture_check_recognized () from
/usr/lib64/libgtk-3.so.0
#70 0x00007ffff5d2051b in gtk_gesture_handle_event () from
/usr/lib64/libgtk-3.so.0
#71 0x00007ffff5d2377b in gtk_gesture_single_handle_event () from
/usr/lib64/libgtk-3.so.0
#72 0x00007ffff5ce810c in gtk_event_controller_handle_event () from
/usr/lib64/libgtk-3.so.0
#73 0x00007ffff5ebf29d in _gtk_widget_run_controllers () from
/usr/lib64/libgtk-3.so.0
#74 0x00007ffff5f19aea in _gtk_marshal_BOOLEAN__BOXEDv () from
/usr/lib64/libgtk-3.so.0
#75 0x00007ffff4f3355c in _g_closure_invoke_va () from
/usr/lib64/libgobject-2.0.so.0
#76 0x00007ffff4f4b3ab in g_signal_emit_valist () from
/usr/lib64/libgobject-2.0.so.0
#77 0x00007ffff4f4c22f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#78 0x00007ffff5ec153c in gtk_widget_event_internal.part () from
/usr/lib64/libgtk-3.so.0
#79 0x00007ffff5d6d018 in propagate_event () from /usr/lib64/libgtk-3.so.0
#80 0x00007ffff5d6ed0b in gtk_main_do_event () from /usr/lib64/libgtk-3.so.0
#81 0x00007ffff5a7d905 in _gdk_event_emit () from /usr/lib64/libgdk-3.so.0
#82 0x00007ffff5ab3682 in gdk_event_source_dispatch () from
/usr/lib64/libgdk-3.so.0
#83 0x00007ffff4e45aeb in g_main_context_dispatch () from
/usr/lib64/libglib-2.0.so.0
#84 0x00007ffff4e45da5 in g_main_context_iterate.constprop () from
/usr/lib64/libglib-2.0.so.0
#85 0x00007ffff4e460db in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#86 0x00007ffff5d6dd2d in gtk_main () from /usr/lib64/libgtk-3.so.0
#87 0x00007ffff778382d in wxGUIEventLoop::DoRun (this=0x555555637320)
at ../src/gtk/evtloop.cpp:64
#88 0x00007ffff72a07e9 in wxEventLoopBase::Run (this=0x555555637320)
at ../src/common/evtloopcmn.cpp:90
#89 0x00007ffff7264722 in wxAppConsoleBase::MainLoop
(this=0x5555556166f0) at ../src/common/appbase.cpp:380
#90 0x00007ffff726444b in wxAppConsoleBase::OnRun
(this=0x5555556166f0) at ../src/common/appbase.cpp:301
#91 0x00007ffff7867f65 in wxAppBase::OnRun (this=0x5555556166f0) at
../src/common/appcmn.cpp:335
#92 0x00007ffff72d9a49 in wxEntry (argc=@0x7ffff7456ff0: 1,
argv=0x5555556165c0) at ../src/common/init.cpp:507
#93 0x00007ffff72d9b1f in wxEntry (argc=@0x7fffffffdc4c: 1,
argv=0x7fffffffdd48) at ../src/common/init.cpp:519
#94 0x00005555555791a6 in main (argc=1, argv=0x7fffffffdd48) at
/home/igor/dbhandler/dbhandler/docview.cpp:69
(gdb)
[/code]

My scenario is as follows:

I have a wxDocMDIChildFrame, which contains a wxNotebook. One of the
wxNotebook pages contaiins wxDataViewListControl.

I don't handle any focus events and the logger shows up during the notebook
creation.

Obviously, no such message exist in Windows or OSX.

Program works fine otherwise.

So, before trying to create a reproducer - should I be worried about that?
Or is this just a warning that can be safely ignored?

Thank you.

Vadim Zeitlin

unread,
Jun 9, 2021, 7:08:20 PM6/9/21
to wx-...@googlegroups.com
On Sun, 6 Jun 2021 02:36:26 -0500 Igor Korot wrote:

IK> Hi, (Paul, Vadim),
IK> I recently updated my Linux box and with latest wxWidgets release started
IK> seeing this:
IK>
IK> [quote]
IK> 02:29:00: Debug: window wxDataViewListCtrl(0x555555d9b800) lost focus
IK> even though it didn't have it
IK> [/quote]

Do you use native or generic wxDVC? I initially thought this was related
to 3ed930c736 (Use wxCompositeWindow for generic wxDataViewCtrl
implementation, 2021-05-23), but it shouldn't have affected the native GTK
version.

IK> So, before trying to create a reproducer - should I be worried about that?
IK> Or is this just a warning that can be safely ignored?

This is not supposed to happen and may/will result in (un)expected focus
events being (not) generated. I.e. this should be fixed, but, as you've
correctly surmised, the first step in fixing it would be to try to
reproduce it in the simplest possible example. Notably I don't think it
should be related to MDI (it's just another notebook in GTK anyhow), but I
could be wrong about it.

If you can reproduce it in a sample, please open a ticket with your patch
to it.

Thanks,
VZ

Igor Korot

unread,
Jun 9, 2021, 8:39:05 PM6/9/21
to wx-dev
Vadim,


On Wed, Jun 9, 2021, 4:08 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
On Sun, 6 Jun 2021 02:36:26 -0500 Igor Korot wrote:

IK> Hi, (Paul, Vadim),
IK> I recently updated my Linux box and with latest wxWidgets release started
IK> seeing this:
IK>
IK> [quote]
IK> 02:29:00: Debug: window wxDataViewListCtrl(0x555555d9b800) lost focus
IK> even though it didn't have it
IK> [/quote]

 Do you use native or generic wxDVC? I initially thought this was related
to 3ed930c736 (Use wxCompositeWindow for generic wxDataViewCtrl
implementation, 2021-05-23), but it shouldn't have affected the native GTK
version.

This is with native wxDVLC.


IK> So, before trying to create a reproducer - should I be worried about that?
IK> Or is this just a warning that can be safely ignored?

 This is not supposed to happen and may/will result in (un)expected focus
events being (not) generated. I.e. this should be fixed, but, as you've
correctly surmised, the first step in fixing it would be to try to
reproduce it in the simplest possible example. Notably I don't think it
should be related to MDI (it's just another notebook in GTK anyhow), but I
could be wrong about it.

Ok, when i get back to the box ill try to create a reproducer, since you said it shouldn't happen.
now, I'm not handling any focus events myself, so I'm not really worried about them, but Someone else might.

now, the only reason I mention MDI is because this is my environment. Looking at the backtrack I don't think it plays any role in it so I will start with notebook sample.


 If you can reproduce it in a sample, please open a ticket with your patch
to it.

Will do.

Thx.


 Thanks,
VZ
Reply all
Reply to author
Forward
0 new messages