luspi / photoqt

PhotoQt Image Viewer (mirror repo) - https://photoqt.org
GNU General Public License v2.0
49 stars 11 forks source link

[macOS] photoqt crashes on start on Sonoma / arm64 #19

Open barracuda156 opened 10 months ago

barracuda156 commented 10 months ago

I have built now v. 3.4 on Sonoma, however it crashes on launch:

svacchanda@Sergeys-MacBook-Air Develop % /opt/local/bin/photoqt

PhotoQt v3.4
 > Validating configuration... 
QSqlDatabasePrivate::addDatabase: duplicate connection name 'shortcutsdefault', old connection removed.
 >> Done!

zsh: trace trap  /opt/local/bin/photoqt

photoqt-2023-11-08-171122.txt

luspi commented 10 months ago

Hi @barracuda156

I'm not too familiar with macOS, but what I can gather from the log file it seems to crash when an unhandled exception is thrown by GraphicsMagick, in particular when querying Magick::CoderInfo. This happens in the file cplusplus/settings/imageformats.cpp on startup when reading in the image formats database. There it does catch all Magick::Exception but from what I understand from the log file it seems like this exception is called MagickLib::ExceptionType on macOS.

Try the following: In the file cplusplus/settings/imageformats.cpp change lines 219 and 393 from } catch(Magick::Exception &) { to } catch(...) { and recompile.

barracuda156 commented 10 months ago

@luspi Thank you for responding! Should I literally leave (...) or something should still go in? Having the former did not seem to help.

I can try disabling whatever is disableable and see if that works to begin with.

luspi commented 10 months ago

The three dots act as a catch-all for any exception. If it still crashes with that in place, then try disabling GraphicsMagick in CMake and recompile. If it still crashes that means we're on the wrong path anyways as it must be caused by something else then.

barracuda156 commented 9 months ago

@luspi Sorry for a delay. So, photoqt builds and does not crash on launch when linked to ImageMagick instead of GraphicsMagick (tested on Sonoma/aarch64). So the issue is indeed with GraphicsMagick.

luspi commented 9 months ago

Ok, that's great to hear that you got it to work. From the point of view of PhotoQt, the API of both should be identical. I have had issues with GraphicsMagick before, though they had all been with the compilation and not running.

barracuda156 commented 8 months ago

@luspi Since photoqt-legacy is read-only, writing this here: its .desktop file seems to have some issue:

Error in file "/opt/local/share/applications/photoqt.desktop": "vector/x-hpgl" is an invalid MIME type ("vector" is an unregistered media type)
Error in file "/opt/local/share/applications/photoqt.desktop": "vector/x-hpgl2" is an invalid MIME type ("vector" is an unregistered media type)
Error in file "/opt/local/share/applications/photoqt.desktop": " image/pcx" is an invalid MIME type (" image" is an unregistered media type)
luspi commented 8 months ago

Thanks, vector/x-hpgl and vector/x-hpgl2 indeed don't actually exist, image/pcx should be image/x-pcx.

barracuda156 commented 8 months ago

@luspi So basically we need to remove one? I did not initially notice image/x-pcx was there already:

image/pcx;image/x-pc-paintbrush;image/x-pcx;application/vnd.palm;
luspi commented 8 months ago

Oh, wait, just wondering, why did you take the desktop file from the legacy repository? Running cmake should create the appropriate desktop file with the right mime types for your current build.

barracuda156 commented 8 months ago

@luspi Because this is on 10.6, where we only got Qt4, and the 1.0 legacy version is the last one to support it.

luspi commented 8 months ago

Ah, sorry, I knew that...

The mime type entry should look something like this: MimeType=image/bmp;image/x-bmp;image/x-ms-bmp;image/dds;image/x-dds;image/gif;image/tiff;image/jp2;image/jpx;image/jpeg;image/x-mng;image/vnd.microsoft.icon;image/x-icon;image/picon;image/png;image/x-portable-anymap;image/x-portable-graymap;image/x-xbitmap;image/x-portable-bitmap;image/pbm;image/x-xpixmap;image/x-portable-pixmap;image/svg+xml;image/svg-xml;image/svg;text/xml-svg;image/vnd.wap.wbmp;image/wbm;video/x-mng;image/fits;image/g3fax;image/mat;image/matlab;image/miff;image/x-mono-bitmap;image/x-otb;image/vnd.nokia.ota-bitmap;image/x-palm;image/pcd;image/x-photo-cd;image/vnd.swiftview-pcx;image/x-pc-paintbrush;image/x-pcx;image/x-pict;image/x-pix;image/sfw;image/x-sgi;image/sgi;image/tga;image/x-tga;image/targa;image/x-targa;image/tim;image/vicar;image/x-viff;image/x-wpg;image/wpg;image/x-xwindowdump;image/xwd;image/x-xwd;application/x-stardent-avs;application/x-dr-halo-bitmap;application/x-mtv;application/vnd.palm

If I run this through desktop-file-validate it returns without errors or warnings.