jim-easterbrook / Photini

An easy to use digital photograph metadata (Exif, IPTC, XMP) editing application.
https://photini.readthedocs.io/
GNU General Public License v3.0
157 stars 24 forks source link

Segmentation faults #30

Closed jim-easterbrook closed 5 years ago

jim-easterbrook commented 7 years ago

Photini may fail to run with some versions of PyQt. If started from a terminal you may get a "Segmentation fault" error message. If this happens, try using the --version option and reporting the details here. For example:

jim@linux-6fe1:~> photini
Segmentation fault (core dumped)
jim@linux-6fe1:~> photini --version
Photini 2017.6.1, build 822 (a668831)
  Python 3.6.1 (default, Mar 23 2017, 13:04:44) [GCC]
  PyGI 3.24.1, GExiv2 0.10.4, GObject 2.0
  PyQt 5.8.2, Qt 5.9.0, using QtWebEngineWidgets
  enchant 1.6.8
  flickrapi 2.2.1
jim@linux-6fe1:~> 

My testing so far suggests the problem is with the QtWebEngine replacement for QtWebKit. When this works it's faster, and the Bing map aerial view selector works, so I'd prefer to use it. I think I'm going to have to provide a way of manually disabling it though, as I don't have a definitive list of which PyQt versions are safe.

jim-easterbrook commented 7 years ago

Commit 8ad61d4 adds options to the editor.ini file to disable Qt5 and/or QtWebEngine.

jim-easterbrook commented 7 years ago

Here's a short script that tests QtWebEngine.

#!/usr/bin/env python

import sys

from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets

def main(argv=None):
    print('PyQt {}, Qt {}'.format(
        QtCore.PYQT_VERSION_STR, QtCore.QT_VERSION_STR))
    app = QtWidgets.QApplication(sys.argv)
    view = QtWebEngineWidgets.QWebEngineView()
    view.load(QtCore.QUrl("http://qt-project.org/"))
    view.show()
    return app.exec_()

if __name__ == "__main__":
    sys.exit(main())
lgbaldoni commented 6 years ago

Any news here? Or workaround? (the script segfaults for me as well)

jim-easterbrook commented 6 years ago

Does disabling Qt5 and/or QtWebEngine in your config file (editor.ini) help at all?

lgbaldoni commented 6 years ago

It falls back to PyQt4 and QtWebKit and the latter is no longer available on account of security.

jim-easterbrook commented 6 years ago

Ah, that's a real problem. As you can see, the test script is as simple as possible so there is no work around within a Python script. Upgrading or downgrading your PyQt installation seems to be the only option.

lgbaldoni commented 6 years ago

I have PyQt4, but how can I do without QtWebKit?

jim-easterbrook commented 6 years ago

You need either QtWebKit or QtWebEngine. Some versions of PyQt5 ship with QtWebEngine, some with QtWebKit and some with both.

jim-easterbrook commented 6 years ago

It might be possible to adapt Photini to run without either. The Facebook uploader and map tabs would not be available.

lgbaldoni commented 6 years ago
~> photini --version
Photini 2018.2.0, build 1028 (c6281ac)
  Python 3.6.4 (default, Jan 03 2018, 13:52:55) [GCC]
  PyGI 3.26.1, GExiv2 0.10.6, GObject 2.0
  PyQt 5.10.2.dev1804151313, Qt 5.9.4, using QtWebEngine
  available styles: Breeze, gtk2, Windows, Fusion

I tried a snapshot of pyqt 5.10.2, no change. Do you think it's an incompatibility? Because downgrading is not really an option and if this problem can't be solved, Photini will have to be pulled from openSUSE.

jim-easterbrook commented 6 years ago

If the test script won't run then neither will any Python application that uses PyQt and QtWebEngine. I'm using openSUSE Leap 42.3 with PyQt 5.5.1, Qt 5.6.2 and QtWebKit. I'll try it in a tumbleweed virtual machine tomorrow.

lgbaldoni commented 6 years ago

Donì't bother, Tumbleweed works. It's the Leap 15.0 beta that doesn't. It's on Qt 5.9 while TW uses 5.10.

jim-easterbrook commented 6 years ago

My Tumbleweed VM hasn't been updated for a while, it's still on PyQt 5.9, Qt 5.10.0 (Python 3.6.4) and the test script crashes. On a Windows 7 VM I have PyQt 5.10, Qt 5.10.0 and it works OK (Python 3.6.3).

jim-easterbrook commented 6 years ago

I've updated my Tumbleweed VM to PyQt 5.10, Qt 5.10.0 and the test script still segfaults. Maybe this isn't to do with PyQt version but is a missing dependency problem. QtWebEngine does seem to have quite a few requirements: https://doc.qt.io/qt-5.10/qtwebengine-deploying.html

jim-easterbrook commented 6 years ago

After much experimenting I've found that installing libglvnd-devel appears to solve the segfault problem (libglvnd was already installed). The test script and Photini both run, but the Bing map doesn't show correctly.

jim-easterbrook commented 6 years ago

This appears to be the culprit. https://bugreports.qt.io/browse/QTBUG-67537

lgbaldoni commented 6 years ago

Thanks a lot for the thorough search. Will try and have that commit backported as patch.

jim-easterbrook commented 6 years ago

Commit f2f42c2 cures the problem on my Tumbleweed virtual machine.

lgbaldoni commented 6 years ago

Confirm. That patch fixes Leap 15.0 too. I guess we're done here.

jim-easterbrook commented 6 years ago

Commit b9f8a50 seems to fix the blank Bing map problem.

lgbaldoni commented 6 years ago

Works for me.

jim-easterbrook commented 6 years ago

Thanks. Though I expect there's some combination of PyQt and video driver out there that it doesn't work for.