Bug 154535 - XML Form Document: Useless Binding created for Root Instance
Summary: XML Form Document: Useless Binding created for Root Instance
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.1.0.0.alpha0+
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.6.0 target:7.5.4
Keywords: bibisected, bisected, regression
Depends on:
Blocks: XML_Form
  Show dependency treegraph
 
Reported: 2023-04-01 06:34 UTC by Robert Großkopf
Modified: 2023-05-11 09:18 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2023-04-01 06:34:35 UTC
Go to File → New → XML Form Document.
On sidebar go to "Instance 1".
Click on "instanceData".
Now change to "Bindings".
A binding has been created "Binding 1:"
This binding isn't connected to "instanceData"

A binding without a connection is useless. Don't know if a binding to root element could work.

Now edit this useless binding and set it to "instanceData".
Switch back to "Instance 1". 
Click on "instanceData".
Change to "Bindings"
A new useless binding has been created.

If there is created a binding while clicking on an element in "Instance 1" there should be created a binding to this element, not a binding to nowhere.

This bug appears on LO 7.5.2.2 on OpenSUSE 15.4 64bit rpm Linux.
Comment 1 Buovjaga 2023-04-20 13:04:28 UTC
I repro the first part, but I don't know how to do this: Now edit this useless binding and set it to "instanceData"

Bibisected with Windows 7.1 repo to 3c5e074a8fe5e0a18d326d37bc54a5ec0f077e4e
weld DataNavigator
Comment 2 Robert Großkopf 2023-04-20 14:38:27 UTC
(In reply to Buovjaga from comment #1)
> I repro the first part, but I don't know how to do this: Now edit this
> useless binding and set it to "instanceData"

Right mouse click on "Binding 1:" → Edit Binding
Binding Expression → "instanceData"
Press OK and the Expression will appear:
"Binding 1:" will be changed to "Binding 1: instanceData"

This will create the connection for example for a form control to put values to the xml form document.
Comment 3 Caolán McNamara 2023-04-21 10:46:32 UTC
probably have to build the version before that commit and side by side debug why there is a difference. The bt of where "Binding 1" is inserted into the treeview is

#0  svxform::XFormsPage::SetModel(com::sun::star::uno::Reference<com::sun::star::xforms::XModel> const&, int)
    (this=0x7a8cbe0, _xModel=uno::Reference to (xforms::Model *) 0x60892b8, _nPagePos=-1) at /home/caolan/LibreOffice/core/svx/source/form/datanavi.cxx:1106
#1  0x00007ffff0c99df1 in svxform::DataNavigatorWindow::SetPageModel(rtl::OUString const&) (this=0x67dd4d0, rIdent="bindings")
    at /home/caolan/LibreOffice/core/svx/source/form/datanavi.cxx:1825
#2  0x00007ffff0c98daa in svxform::DataNavigatorWindow::ActivatePageHdl(rtl::OUString const&) (this=0x67dd4d0, rIdent="bindings")
    at /home/caolan/LibreOffice/core/svx/source/form/datanavi.cxx:1703
#3  0x00007ffff0c98d2d in svxform::DataNavigatorWindow::LinkStubActivatePageHdl(void*, rtl::OUString const&) (instance=0x67dd4d0, data="bindings")
    at /home/caolan/LibreOffice/core/svx/source/form/datanavi.cxx:1697
#4  0x00007fffd91d5c7b in Link<rtl::OUString const&, void>::Call(rtl::OUString const&) const (this=0x68a8fc8, data="bindings")
    at /home/caolan/LibreOffice/core/include/tools/link.hxx:111
#5  0x00007fffd916c70d in (anonymous namespace)::GtkInstanceNotebook::signal_switch_page(int) (this=0x68a8c70, nNewPage=2)
    at /home/caolan/LibreOffice/core/vcl/unx/gtk3/gtkinst.cxx:8821
#6  0x00007fffd916c42f in (anonymous namespace)::GtkInstanceNotebook::signalSwitchPage(GtkNotebook*, GtkWidget*, guint, gpointer) (nNewPage=2, widget=0x68a8c70)
    at /home/caolan/LibreOffice/core/vcl/unx/gtk3/gtkinst.cxx:8787

but its not clear if this path wasn't taken before, or if there is something else that has caused the data to be created that then gets shown in the tree
Comment 4 Caolán McNamara 2023-04-21 14:41:54 UTC
aha, I see the trigger now. I moved the "prepare drag and drop" into the select entry callback, and looking at the old code it is also the case the binding is created if you drag an entry in the instance treeview (even if you abandon the dnd) except that wasn't called on simply selecting an entry. That at least explains the mystery
Comment 5 Commit Notification 2023-04-21 19:18:36 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1d0fadfd218b872ee5d4b07b88320c8f37667218

Resolves: tdf#154535 create the OXFormsDescriptor on-demand

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Caolán McNamara 2023-04-22 20:56:47 UTC
done in trunk, backport to 7-5 in gerrit
Comment 7 Robert Großkopf 2023-04-27 08:35:43 UTC
Have tested with
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: cb79692883e92de02d87b0662a431f6ff8fba9c8
CPU threads: 6; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

Works now as expected.
Comment 8 Commit Notification 2023-05-11 09:18:35 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/fcb6dfb38ad2d311071979046aac9b6a31d7deb1

Resolves: tdf#154535 create the OXFormsDescriptor on-demand

It will be available in 7.5.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.