laumaya / GLC_Player

13 stars 11 forks source link

next: png files are broken? #6

Open JayFoxRox opened 6 years ago

JayFoxRox commented 6 years ago

The png files in the "next" branch, are.. weird. They look fine in all my image viewers and browser. However, they crash GLC_Player for me.

I'm running Arch Linux with "libpng 1.6.34-2", "zlib 1:1.2.11-2" and "qt5-base 5.10.1-8". I'm running GLC_lib Version_3_0_1 from your GitHub repo.

When running GLC_Player on master I get a crash like this:

(gdb) r
Starting program: /home/fox/Data/Projects/GLC_Player/glc_player 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe9d5b700 (LWP 2214)]
[New Thread 0x7fffde934700 (LWP 2215)]
[New Thread 0x7fffde133700 (LWP 2216)]
[New Thread 0x7fffd662c700 (LWP 2217)]
libpng warning: iCCP: known incorrect sRGB profile
libpng error: unexpected zlib return code
"GLC_Texture::GLC_Texture open image : :images/default_background.png Failed"
"---------------------------------------------------------------------"
"GLC_Texture::GLC_Texture open image : :images/default_background.png Failed"
terminate called after throwing an instance of 'GLC_Exception'
  what():  GLC_Exception : GLC_Texture::GLC_Texture open image : :images/default_background.png Failed

Thread 1 "glc_player" received signal SIGABRT, Aborted.
0x00007ffff3cacefb in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff3cacefb in raise () at /usr/lib/libc.so.6
#1  0x00007ffff3cae2c1 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff466cd57 in __gnu_cxx::__verbose_terminate_handler() () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff466a8c6 in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x00007ffff466a913 in std::terminate() () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007ffff466ab68 in __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*)) (obj=<optimized out>, tinfo=0x7ffff7dce140 <typeinfo for GLC_Exception>, dest=0x7ffff7b66e30 <GLC_Exception::~GLC_Exception()>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:93
#6  0x00007ffff7b3818b in GLC_Texture::GLC_Texture(QString const&) () at /home/fox/Data/Projects/GLC_Player/../GLC_lib/src/lib/libGLC_lib.so.3
#7  0x00007ffff7b62013 in GLC_Factory::createTexture(QString const&) const () at /home/fox/Data/Projects/GLC_Player/../GLC_lib/src/lib/libGLC_lib.so.3
#8  0x00007ffff7b4af83 in GLC_ImagePlane::GLC_ImagePlane(QString const&, bool) () at /home/fox/Data/Projects/GLC_Player/../GLC_lib/src/lib/libGLC_lib.so.3
#9  0x00007ffff7b4cc5f in GLC_Viewport::loadBackGroundImage(QString const&, bool) () at /home/fox/Data/Projects/GLC_Player/../GLC_lib/src/lib/libGLC_lib.so.3
#10 0x000055555563380b in OpenglView::OpenglView(QWidget*) (this=0x7fffffffe0e8, pParent=0x7fffffffddc0) at opengl_view/OpenglView.cpp:84
#11 0x00005555555824aa in glc_player::glc_player(QWidget*) (this=0x7fffffffddc0, parent=0x0) at glc_player.cpp:101
#12 0x000055555557a83b in main(int, char**) (argc=1, argv=0x7fffffffe868) at main.cpp:95

I can solve this issue by running imagemagick like this in "ressources/images/":

for x in *.png; do convert "$x" "$x"; done

However, even then, I still get an error for (presumably) "ressources/images/3DXMLDefaultPreview.png":

(gdb) break QImage
Breakpoint 1 at 0x555555577570 (12 locations)
(gdb) r
Starting program: /home/fox/Data/Projects/GLC_Player/glc_player 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe9d5b700 (LWP 2374)]
[New Thread 0x7fffde934700 (LWP 2375)]
[New Thread 0x7fffde133700 (LWP 2376)]

Thread 1 "glc_player" hit Breakpoint 1, 0x00007ffff6260d60 in QImage::QImage() () from /usr/lib/libQt5Gui.so.5
(gdb) c 330
Will ignore next 329 crossings of breakpoint 1.  Continuing.
[New Thread 0x7fffd662c700 (LWP 2391)]

Thread 1 "glc_player" hit Breakpoint 1, 0x00007ffff6260d60 in QImage::QImage() () from /usr/lib/libQt5Gui.so.5
(gdb) bt
#0  0x00007ffff6260d60 in QImage::QImage() () at /usr/lib/libQt5Gui.so.5
#1  0x00007ffff628503a in QImageReader::read() () at /usr/lib/libQt5Gui.so.5
#2  0x00007ffff62aabfc in QPixmapIconEngine::addFile(QString const&, QSize const&, QIcon::Mode, QIcon::State) () at /usr/lib/libQt5Gui.so.5
#3  0x00007ffff62adb79 in QIcon::addFile(QString const&, QSize const&, QIcon::Mode, QIcon::State) () at /usr/lib/libQt5Gui.so.5
#4  0x000055555559ee81 in Ui_glc_playerClass::setupUi(QMainWindow*) (this=0x7fffffffddf0, glc_playerClass=0x7fffffffddc0) at Build/ui_glc_player.h:437
#5  0x00005555555827eb in glc_player::glc_player(QWidget*) (this=0x7fffffffddc0, parent=0x0) at glc_player.cpp:103
#6  0x000055555557a83b in main(int, char**) (argc=1, argv=0x7fffffffe868) at main.cpp:95
(gdb) up 4
(gdb) 
#4  0x000055555559ee81 in Ui_glc_playerClass::setupUi (this=0x7fffffffddf0, glc_playerClass=0x7fffffffddc0) at Build/ui_glc_player.h:437
437         icon38.addFile(QStringLiteral(":/images/3DXMLDefaultPreview.png"), QSize(), QIcon::Normal, QIcon::Off);
(gdb) c
Continuing.
libpng warning: zTXt: unexpected zlib return code
Thread 1 "glc_player" hit Breakpoint 1, 0x00007ffff6264040 in QImage::QImage(QSize const&, QImage::Format) () from /usr/lib/libQt5Gui.so.5

I have not had any other Qt5 / libpng / zlib issues with my system yet. So I think this is either a problem with these files, or incompatible versions / headers / code. I have previously only patched a subset of the files and GLC_Player will run but the images are not displayed in the toolbars etc.


I actually get another error when opening a "File open" dialog:

(glc_player:3778): Gtk-WARNING **: 23:53:23.000: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/gnome/16x16/status/image-missing.png: Fatal error reading PNG image file: bad parameters to zlib (gdk-pixbuf-error-quark, 0)

So I assume this is an issue with libpng / zlib somehow.. but it only seems to happen in GLC_Player / GLC_lib

JayFoxRox commented 6 years ago

Skimming over the GLC_lib code, it's possible that this is a linker issue.

GLC_lib compiles zlib itself, so it probably exposes the same symbols. So when the dynamic linker searches for zlib (when Qt5 / libpng asks), it might also find the exports from GLC_lib, which might result in Qt5 / libpng using those calls - regardless of the version it was build for. This is very poor software design in general - if you want to use zlib, you should build it normally and then link statically against it. Here it is just Frankenstein-ed together by adding all source and header files to the build process..

revast commented 6 years ago

have you managed to have it compile and run from the "next branch"?