Bug 157671 - Combo box in a Table control grid throws "When losing focus" event when receive focus
Summary: Combo box in a Table control grid throws "When losing focus" event when recei...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.0.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bisected, regression
Depends on:
Blocks:
 
Reported: 2023-10-09 19:30 UTC by jcsanz
Modified: 2024-04-19 16:15 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Database with macros to reproduce the bug (13.69 KB, application/vnd.sun.xml.base)
2023-10-09 19:31 UTC, jcsanz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jcsanz 2023-10-09 19:30:11 UTC
Description:
When enter in a combo box in a table grid control it is thrown the event "on lost focus". Also if you expand the combo box and select any other option the "on lost focus" event is thrown

Steps to Reproduce:
You need configure LibreOffice in a way that is able to execute macros
1.Open the .odb sample file.
2.Go to the only form in the odb file and open it
3.Clic in any data in the column "Nombre" which is a combo box control
4.The "When losing focus" event is thrown and a MsgBox in a macro is shown

Actual Results:
The "When losing focus" event is thrown (detected by the macro)

Expected Results:
Only the "When receiving focus" event should be thrown


Reproducible: Always


User Profile Reset: No

Additional Info:
The "When receiving focus" event is also thrown when expand the combo box and select a different option.
Tested with version 6.4.7.2 and the error is not present, so it is a regression.
----
Bug reproducible with

Version: 7.0.6.2 (x64)
Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); Interfaz: es-ES
Calc: CL
----
Also reproducible with

Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: es-ES (es_ES.UTF-8); UI: es-ES
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.3
Calc: threaded
----
*NOT* reproducible with

Versión: 6.4.7.2 (x64)
Id. de compilación: 639b8ac485750d5696d7590a72ef1b496725cfb5
Subprocs. CPU: 16; SO: Windows 10.0 Build 22621; Repres. IU: GL; VCL: win; 
Configuración regional: es-ES (es_ES); Idioma de IU: es-ES
Calc: CL
Comment 1 jcsanz 2023-10-09 19:31:13 UTC
Created attachment 190098 [details]
Database with macros to reproduce the bug
Comment 2 jcsanz 2023-10-09 20:21:20 UTC
Regression introduced by:

author	Caolán McNamara <caolanm@redhat.com>	2020-05-13 13:59:11 +0100
committer	Caolán McNamara <caolanm@redhat.com>	2020-05-20 20:24:16 +0200
commit 68d161c6803654f4ce816af7e79371a2d3497b4f (patch)
tree 97cc8e55906b91ac966d7b1c09bdfcf51e8480f9
parent 96536d92e8026cebfde11e5539ee90471d0e7933 (diff)
weld ComboBoxControl

Bisected with: bibisect-win64-7.0

Adding Cc: Caolán McNamara
Comment 3 Julien Nabet 2024-04-19 16:15:12 UTC
On pc Debian x86-64 with master sources updated today, I gave a new try, I could reproduce this.
I retrieved some bts with gen rendering:
first OnFocusGained is called with:
#0  FmXGridCell::onFocusGained(com::sun::star::awt::FocusEvent const&) (this=0x559179c9c6a0, _rEvent=...) at svx/source/fmcomp/gridcell.cxx:3449
#1  0x00007f6642c831d0 in FmXGridCell::OnFocusGained(LinkParamNone*) (this=0x559179c9c6a0) at svx/source/fmcomp/gridcell.cxx:3467
#2  0x00007f6642c81c0d in FmXGridCell::LinkStubOnFocusGained(void*, LinkParamNone*) (instance=0x559179c9c6a0, data=0x0) at svx/source/fmcomp/gridcell.cxx:3458
#3  0x00007f6641e86b78 in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x559179c2ccd8, data=0x0) at include/tools/link.hxx:111
#4  0x00007f6641e81068 in svt::ControlBase::FocusInHdl(weld::Widget&) (this=0x559179c2cb90) at svtools/source/brwbox/ebbcontrols.cxx:396
#5  0x00007f6641e7cf0d in svt::ControlBase::LinkStubFocusInHdl(void*, weld::Widget&) (instance=0x559179c2cb90, data=...) at svtools/source/brwbox/ebbcontrols.cxx:394
#6  0x00007f6640130b28 in Link<weld::Widget&, void>::Call(weld::Widget&) const (this=0x559179bab738, data=...) at include/tools/link.hxx:111
#7  0x00007f66400f1f95 in SalInstanceWidget::HandleEventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/source/app/salvtables.cxx:735
#8  0x00007f664013af05 in SalInstanceComboBox<ComboBox>::CallHandleEventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/inc/salvtables.hxx:934
#9  0x00007f6640125254 in SalInstanceComboBoxWithEdit::HandleEventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/source/app/salvtables.cxx:6765
#10 0x00007f66400f269d in SalInstanceWidget::EventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/source/app/salvtables.cxx:822
#11 0x00007f66400eeefd in SalInstanceWidget::LinkStubEventListener(void*, VclWindowEvent&) (instance=0x559179bab690, data=...) at vcl/source/app/salvtables.cxx:820
#12 0x00007f663f7cedd8 in Link<VclWindowEvent&, void>::Call(VclWindowEvent&) const (this=0x559179d406b0, data=...) at include/tools/link.hxx:111
#13 0x00007f663f7cbb4e in vcl::Window::CallEventListeners(VclEventId, void*) (this=0x559179c92980, nEvent=VclEventId::WindowGetFocus, pData=0x0) at vcl/source/window/event.cxx:262
#14 0x00007f663f7cb64c in vcl::Window::PreNotify(NotifyEvent&) (this=0x559179c92980, rNEvt=...) at vcl/source/window/event.cxx:70
#15 0x00007f663f9b6689 in Edit::PreNotify(NotifyEvent&) (this=0x559179c92980, rNEvt=...) at vcl/source/control/edit.cxx:1925
#16 0x00007f663f93834d in vcl::Window::CompatPreNotify(NotifyEvent&) (this=0x559179c92980, rNEvt=...) at vcl/source/window/window.cxx:3940
#17 0x00007f663f948501 in ImplCallPreNotify(NotifyEvent&) (rEvt=...) at vcl/source/window/winproc.cxx:69


FIRST GAP

#18 0x00007f663f85b92e in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c92980, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:383

SECOND GAP

#19 0x00007f663f925537 in vcl::Window::GrabFocus() (this=0x559179c92980) at vcl/source/window/window.cxx:2988
#20 0x00007f66400ef681 in SalInstanceWidget::grab_focus() (this=0x559179bab690) at vcl/source/app/salvtables.cxx:389
#21 0x00007f663f9fcde0 in InterimItemWindow::GetFocus() (this=0x559179c2cb90) at vcl/source/control/InterimItemWindow.cxx:135
#22 0x00007f663f93823c in vcl::Window::CompatGetFocus() (this=0x559179c2cb90) at vcl/source/window/window.cxx:3908
#23 0x00007f663f85b9a1 in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c2cb90, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:384
#24 0x00007f663f925537 in vcl::Window::GrabFocus() (this=0x559179c2cb90) at vcl/source/window/window.cxx:2988
#25 0x00007f6641e8d298 in svt::EditBrowseBox::StartEditHdl(void*) (this=0x559179c52260) at svtools/source/brwbox/editbrowsebox.cxx:208
#26 0x00007f6641e8d1ed in svt::EditBrowseBox::LinkStubStartEditHdl(void*, void*) (instance=0x559179c52260, data=0x0) at svtools/source/brwbox/editbrowsebox.cxx:201

and when OnFocusLost is called:
#0  FmXGridCell::onFocusLost(com::sun::star::awt::FocusEvent const&) (this=0x559179c9c6a0, _rEvent=...) at svx/source/fmcomp/gridcell.cxx:3455
#1  0x00007f6642c832d0 in FmXGridCell::OnFocusLost(LinkParamNone*) (this=0x559179c9c6a0) at svx/source/fmcomp/gridcell.cxx:3479
#2  0x00007f6642c81c3d in FmXGridCell::LinkStubOnFocusLost(void*, LinkParamNone*) (instance=0x559179c9c6a0, data=0x0) at svx/source/fmcomp/gridcell.cxx:3470
#3  0x00007f6641e86b78 in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x559179c2cd00, data=0x0) at include/tools/link.hxx:111
#4  0x00007f6641e810b8 in svt::ControlBase::FocusOutHdl(weld::Widget&) (this=0x559179c2cb90) at svtools/source/brwbox/ebbcontrols.cxx:402
#5  0x00007f6641e7cf3d in svt::ControlBase::LinkStubFocusOutHdl(void*, weld::Widget&) (instance=0x559179c2cb90, data=...) at svtools/source/brwbox/ebbcontrols.cxx:400
#6  0x00007f6640130b28 in Link<weld::Widget&, void>::Call(weld::Widget&) const (this=0x559179bab760, data=...) at include/tools/link.hxx:111
#7  0x00007f66400f1fca in SalInstanceWidget::HandleEventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/source/app/salvtables.cxx:737
#8  0x00007f664013af05 in SalInstanceComboBox<ComboBox>::CallHandleEventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/inc/salvtables.hxx:934
#9  0x00007f6640125254 in SalInstanceComboBoxWithEdit::HandleEventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/source/app/salvtables.cxx:6765
#10 0x00007f66400f269d in SalInstanceWidget::EventListener(VclWindowEvent&) (this=0x559179bab690, rEvent=...) at vcl/source/app/salvtables.cxx:822
#11 0x00007f66400eeefd in SalInstanceWidget::LinkStubEventListener(void*, VclWindowEvent&) (instance=0x559179bab690, data=...) at vcl/source/app/salvtables.cxx:820
#12 0x00007f663f7cedd8 in Link<VclWindowEvent&, void>::Call(VclWindowEvent&) const (this=0x559179d3c350, data=...) at include/tools/link.hxx:111
#13 0x00007f663f7cbb4e in vcl::Window::CallEventListeners(VclEventId, void*) (this=0x559179c92980, nEvent=VclEventId::WindowLoseFocus, pData=0x0) at vcl/source/window/event.cxx:262
#14 0x00007f663f7cb71a in vcl::Window::PreNotify(NotifyEvent&) (this=0x559179c92980, rNEvt=...) at vcl/source/window/event.cxx:82
#15 0x00007f663f9b6689 in Edit::PreNotify(NotifyEvent&) (this=0x559179c92980, rNEvt=...) at vcl/source/control/edit.cxx:1925
#16 0x00007f663f93834d in vcl::Window::CompatPreNotify(NotifyEvent&) (this=0x559179c92980, rNEvt=...) at vcl/source/window/window.cxx:3940
#17 0x00007f663f948501 in ImplCallPreNotify(NotifyEvent&) (rEvt=...) at vcl/source/window/winproc.cxx:69

FIRST GAP

#18 0x00007f663f85b5a5 in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c971a0, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:355
#19 0x00007f663f9b5fe0 in Edit::GetFocus() (this=0x559179c92980) at vcl/source/control/edit.cxx:1845
#20 0x00007f663f93823c in vcl::Window::CompatGetFocus() (this=0x559179c92980) at vcl/source/window/window.cxx:3908

#21 0x00007f663f85b9a1 in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c92980, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:384

SECOND GAP

#22 0x00007f663f925537 in vcl::Window::GrabFocus() (this=0x559179c92980) at vcl/source/window/window.cxx:2988
#23 0x00007f66400ef681 in SalInstanceWidget::grab_focus() (this=0x559179bab690) at vcl/source/app/salvtables.cxx:389
#24 0x00007f663f9fcde0 in InterimItemWindow::GetFocus() (this=0x559179c2cb90) at vcl/source/control/InterimItemWindow.cxx:135
#25 0x00007f663f93823c in vcl::Window::CompatGetFocus() (this=0x559179c2cb90) at vcl/source/window/window.cxx:3908
#26 0x00007f663f85b9a1 in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c2cb90, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:384
#27 0x00007f663f925537 in vcl::Window::GrabFocus() (this=0x559179c2cb90) at vcl/source/window/window.cxx:2988
#28 0x00007f6641e8d298 in svt::EditBrowseBox::StartEditHdl(void*) (this=0x559179c52260) at svtools/source/brwbox/editbrowsebox.cxx:208
#29 0x00007f6641e8d1ed in svt::EditBrowseBox::LinkStubStartEditHdl(void*, void*) (instance=0x559179c52260, data=0x0) at svtools/source/brwbox/editbrowsebox.cxx:201


In both bts, I put FIRST GAP and SECOND GAP.
After SECOND GAP, I think it's pure common part.
Before FIRST GAP, I'm quite sure we can tell event is onFocusGain/onFocusLost depending on first or second bt.

The interesting part is between both gaps
In first one, we just call:
#18 0x00007f663f85b92e in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c92980, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:383

in the second one:
#18 0x00007f663f85b5a5 in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c971a0, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:355
#19 0x00007f663f9b5fe0 in Edit::GetFocus() (this=0x559179c92980) at vcl/source/control/edit.cxx:1845
#20 0x00007f663f93823c in vcl::Window::CompatGetFocus() (this=0x559179c92980) at vcl/source/window/window.cxx:3908

#21 0x00007f663f85b9a1 in vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x559179c92980, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:384

Now I'm not an expert but it seems a method call CompatGetFocus must some kind of technical debt on LO code that we must deal with.