Bug report #17825

File browser broken with gtk backend

Added by landry Landry Breuil about 2 years ago. Updated about 1 year ago.

Status:Rejected
Priority:Normal
Assignee:-
Category:GUI
Affected QGIS version:master Regression?:No
Operating System:OpenBSD Easy fix?:No
Pull Request or Patch supplied:No Resolution:up/downstream
Crashes QGIS or corrupts data:No Copied to github as #:25720

Description

It worked fine in 2.x, and seems broken in 3.x, dunno if that's more a qt4 vs qt5 issue, but when i open the file browser to select a data, the file browser window opens but stays empty, and the console fills with error messages:

@Warning: QFileInfo::absolutePath: Constructed with empty filename
src/core/qgsmessagelog.cpp: 27: (logMessage) [8783ms] 2018-01-09T15:13:57 Qt1 QFileInfo::absolutePath: Constructed with empty filename

(qgis:25562): Gtk-CRITICAL **: Error building template class 'GtkDialog' for an instance of type 'GtkDialog': .:10:1 Invalid object type 'GtkHeaderBar'

(qgis:25562): Gtk-CRITICAL **: _gtk_container_get_border_width_set: assertion 'GTK_IS_CONTAINER (container)' failed

(qgis:25562): Gtk-CRITICAL **: gtk_container_set_border_width: assertion 'GTK_IS_CONTAINER (container)' failed
@

This is with master as of yesterday on OpenBSD, built against qt5.9.3. Not being able to open a file from qgis is a bit of an issue, of course :)

History

#1 Updated by landry Landry Breuil about 2 years ago

The bug is still present in current master, and affects all file open dialogs (ie raster, vector, csv..) so im leaning towards a bug in qgsfilewidget.cpp... maybe ?

#2 Updated by landry Landry Breuil about 2 years ago

This only happens with the Gtk(/fusion?) style, if i force-set the windows style in qt5 config the file open dialog works fine.

#3 Updated by Nyall Dawson about 2 years ago

  • Status changed from Open to Feedback

It's unlikely to be a qgis issue - have you checked for an open issue on your distro?

#4 Updated by landry Landry Breuil about 2 years ago

Well, i'm the one packaging qgis on my OS... will have to recheck with upcoming qt 5.9.5.

Tried the same workflow with the qgis-nightly ubuntu artful repo binaries w/ qt 5.9.1 and of course no issue.

#5 Updated by landry Landry Breuil about 2 years ago

In fact it seems any instance of QgsFileWidget triggers this - 'save project' dialog too. So that's not driver-specific nor only file-opening specific.

#6 Updated by landry Landry Breuil about 2 years ago

Hmm.. i'm looking at what could be specific to BSDs (Asked loic bartoletti from FreeBSD if he was also seeing that bug) and stumbled upon some areas within #if defined(Q_OS_MAC) || defined(Q_OS_LINUX) and one of them is in a file-dialog related.. so maybe some untested/less-tested codepath is taken on BSDs. I'll dig a bit further in this direction.

#7 Updated by landry Landry Breuil about 2 years ago

I think i'm on something here : https://github.com/qgis/QGIS/blob/master/src/gui/qgsguiutils.cpp#L130

The #else codepath is taken on BSDs, and this one untested - build was broken with qt5 until loic bartoletti fixed it in 71b9c77b907ab3912cea15abc2fde1e11c36689d

Is there an actual reason to not use native dialogs on BSDs too, as we're also using qt5 ?

I'm doing a build with BSDs added to this #ifdef and will report back.

#8 Updated by landry Landry Breuil about 2 years ago

Meh. Not this one, wrong track. That code seems to be in the 'save as image' dialog codepath.

#9 Updated by landry Landry Breuil about 2 years ago

After a bit more code digging and printf-debugging, it seems any call to a method of QFileDialog opening a dialog (ie getSaveFileName, getOpenFileName, etc) will trigger the lock. I'm really puzzled.

#10 Updated by landry Landry Breuil about 2 years ago

The first gtk error message is coming from https://github.com/GNOME/gtk/blob/master/gtk/gtkwidget.c#L13085 - so something with Gtk libs not properly initialized ?

#11 Updated by Loïc BARTOLETTI about 2 years ago

Hi,

Here my tests.

With FreeBSD and Debian (ssh -Y into a VM...) I've only these warnings:

Warning: libpng warning: iCCP: known incorrect sRGB profile
Warning: libpng warning: iCCP: known incorrect sRGB profile
Warning: QFileInfo::absolutePath: Constructed with empty filename

Also, I added *BSD in https://github.com/qgis/QGIS/blob/master/src/gui/qgsguiutils.cpp#L130

My branch to test

#12 Updated by Loïc BARTOLETTI about 2 years ago

Hi Landry,

Trying with OpenBSD current, I reproduce the problem with XFCE but no with default wm or Lumina for example.

Trying also with a minimal FreeBSD 11, QGIS master and XFCE I cannot reproduce the problem.

#13 Updated by landry Landry Breuil about 2 years ago

Thanks loic for the testing - fwiw i'm using xfce 4.13 (not released yet) - will have to check on a stock Xfce. Which version of QT5/Gtk+3 are you using in your FreeBSD testing ?

#14 Updated by Loïc BARTOLETTI over 1 year ago

Hi Landry,

Today Qt 5.11, GTK 3.22.30 and XFCE 4.12.

I've never been able to reproduce this bug on FreeBSD. Do you still have this problem with new versions on OpenBSD (I couldn't test it)?

#15 Updated by landry Landry Breuil over 1 year ago

Still reproducible w/ qt 5.9.6, qgis 3.2.3, gtk 3.22.30 & xfce 4.13.

#16 Updated by landry Landry Breuil over 1 year ago

to workaround this i use qt5ct which allows me to set the QT5 gtk theme to something different from the default gtk3 thing (ie for example cleanlooks) and that helps, the file dialogs dont break qgis. It's a bit annoying of course...

#17 Updated by Nyall Dawson about 1 year ago

  • Status changed from Feedback to Rejected
  • Resolution set to up/downstream

Either a GTK or Qt bug, not QGIS

Also available in: Atom PDF