Bug 144084 - FilePicker service does not display Open and Cancel button (gtk3 only)
Summary: FilePicker service does not display Open and Cancel button (gtk3 only)
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.3.0 target:7.2.1
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-25 11:04 UTC by Dorange-Pattoret Didier
Modified: 2021-08-28 06:44 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
bt with debug symbols (12.57 KB, text/plain)
2021-08-25 20:06 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dorange-Pattoret Didier 2021-08-25 11:04:15 UTC
Description:
When I try too select a file, the Open and Cancel button do not appear.
I run a Linux Ubuntu.

Steps to Reproduce:
Try to select a file with the following code :

Option Explicit
Sub OuvrirUnFichier()
Dim FP As Object, lesFichiers() As String

FP = CreateUnoService("com.sun.star.ui.dialogs.FilePicker") 
FP.DisplayDirectory = ConvertToURL("/home/didier/")
FP.appendFilter("Textes", "*.txt")
FP.appendFilter("Documents ODF", "*.odt;*.ods;*.odg,*.odp")
FP.appendFilter("Documents MS-Office", "*.doc;*.xls;*.ppt")
FP.CurrentFilter = "Documents ODF"
FP.Title = "Choisissez le fichier à traiter"

if FP.execute = com.sun.star.ui.dialogs.ExecutableDialogResults.OK then
  lesFichiers() = FP.Files
  MsgBox(FP.CurrentFilter, 0, "Filtre choisi")
  MsgBox(FP.DisplayDirectory, 0, "Répertoire")
  MsgBox(lesFichiers(0), 0, "Chemin complet")
end if
FP.dispose
End Sub

Actual Results:
Can't select the chosen file ...
It's a regression ...

Expected Results:
To be able to select the file ..


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.0.4 / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 1 [REDACTED] 2021-08-25 11:33:21 UTC
No repro

Version: 7.2.0.4 / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 2 [REDACTED] 2021-08-25 11:58:35 UTC
Repro on

Version: 7.2.0.4 / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

=> seems to be related to GTK3
Comment 3 Julien Nabet 2021-08-25 20:06:58 UTC
Created attachment 174539 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today + gtk3 rendering, I could reproduce this.
I noticed 2 things:
warn:rtl.string:4196:4196:sal/rtl/strtmpl.hxx:1294: rtl_uString_newFromLiteral - Found embedded \0 character
warn:rtl.string:4196:4196:sal/rtl/strtmpl.hxx:1294: rtl_uString_newFromLiteral - Found embedded \0 character
warn:rtl.string:4196:4196:sal/rtl/strtmpl.hxx:1294: rtl_uString_newFromLiteral - Found embedded \0 character
warn:rtl.string:4196:4196:sal/rtl/strtmpl.hxx:1294: rtl_uString_newFromLiteral - Found embedded \0 character

+
warn:vcl.gtk:4196:4196:vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:943: no parent widget set

For the last one, I retrieved a stacktrace.
Comment 4 Julien Nabet 2021-08-25 20:08:06 UTC
Caolán: since it's specific to gtk3 (gtk4?), thought you might be interested in this one.
(see my previous comment for some details).
Comment 5 Caolán McNamara 2021-08-26 08:45:58 UTC
presumably the problem is since

commit 43335776cfc18cdc7addf33250cffc886d384186
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Tue May 11 17:21:47 2021 +0100

    gtk[3|4] don't create File Dialog with buttons that need to be removed
    
    just create it without the offending buttons in the first place

inside libreoffice we always call initialize on the file dialogs, but this basic script calls it without that so it makes a difference there
Comment 6 Caolán McNamara 2021-08-26 09:57:05 UTC
The "rtl_uString_newFromLiteral - Found embedded \0 character" warning is from https://gerrit.libreoffice.org/c/core/+/119945 and the embedded nulls are intentional. I don't know if we have any way to suppress that
Comment 7 Stephan Bergmann 2021-08-26 10:59:14 UTC
(In reply to Caolán McNamara from comment #6)
> The "rtl_uString_newFromLiteral - Found embedded \0 character" warning is
> from https://gerrit.libreoffice.org/c/core/+/119945 and the embedded nulls
> are intentional. I don't know if we have any way to suppress that

<https://gerrit.libreoffice.org/c/core/+/121086> "Avoid OUString::createFromAscii on input containing NUL characters" should fix that
Comment 8 Commit Notification 2021-08-26 12:42:21 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0e34a52d8db3ea9c9e60af7c7348793dbc5d4d59

Resolves: tdf#144084 if not initialized default to FILEOPEN_SIMPLE

It will be available in 7.3.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 9 Caolán McNamara 2021-08-26 12:45:04 UTC
done in trunk, backport to 7-2 in gerrit
Comment 10 Commit Notification 2021-08-26 12:48:39 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

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

Resolves: tdf#144084 if not initialized default to FILEOPEN_SIMPLE

It will be available in 7.2.2.

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 11 Julien Nabet 2021-08-26 18:03:58 UTC
Even if I still see:
warn:legacy.tools:103013:103013:basctl/source/basicide/moduldlg.cxx:966: LibEntry not found!
warn:vcl.gtk:103013:103013:vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:951: no parent widget set
on pc Debian x86-64 with master sources updated today, I don't reproduce this.

Thank you Caolán and Stephan!
Comment 12 Commit Notification 2021-08-26 19:55:01 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-2-1":

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

Resolves: tdf#144084 if not initialized default to FILEOPEN_SIMPLE

It will be available in 7.2.1.

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 13 Dorange-Pattoret Didier 2021-08-28 06:44:16 UTC
I tried :
Version: 7.2.2.0.0+ / LibreOffice Community
Build ID: 76cb48b6a00cde41987a1b67b78fee68a133ad53
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:libreoffice-7-2, Time: 2021-08-27_06:52:57
Calc: threaded

It works fine.
Thanks for your work.