To trace this kind of error, it is interesting to compile it with g++, with the flag -fsanitize=address, as it somehow embeds a memory debugger directly in the compiled binary.
To make it simpler to test, it’s probably also better not to run the plug-in, but the stand-alone G’MIC-Qt application from the console.
If there is one error somewhere in the code, then G’MIC-Qt will stop and an error message will appear in the console.
Here are the compilation steps I’ve used:
From the G’MIC-Qt sources, in folder gmic-qt, I first edit the gmic_qt.pro file, replacing lines 448 and 449 by:
(i.e., uncomment and add the -g flag).
Then I compile the stand-alone application in Debug mode:
$ qmake HOST=none CONFIG+=debug
(...)
$ make
It may happen the compiler stops during the link phase with an error about a lot of asan-related functions not found. I just copy/paste the latest g++ command that failed and add -lasan at the end. For me this looks like this (I’m on Ubuntu 19.04) :
(For an unknown reason, I had to do this “manually” because if I add the -lasan flag in the gmic_qt.pro file, it doesn’t succeed at all, because -lasan is put on the beginning of the command, while it has to appear apparently at the end).
Then, you can run the gmic_qt executable, and play with it until a crash:
$ ./gmic_qt image.jpg
So far, I didn’t succeed in having a crash here, but I hope you’ll be able to reproduce your bug this way, and tell us what is going on
Update : I’ve currently compiled G’MIC with the address sanitizer and I get indeed a few issues.
I’ll try to fix those ASAP and make you know when it’s ready.
This will probably lead to a 2.9.4 release…
I’ve made two fixes related to possible wron memory access.
Would you like to test on your machine ?
Basically, you have to modify file gmic.cpp, with the following commits:
and
That’s minor modifications that you can apply on the sources, then you have to recompile everything, and test once again.
Thanks for your help !
I’d love to try it but I’m not finding gmic.cpp in my sources.
I went to the gmic-master source tree in the git links you sent and modified the code as suggested, but then the commands you gave to build it do not work.
Sorry but it seems I need some hand-holding, as I don’t understand how to build it.
I’ll prepare an up-to-date pre-release archive and post it in a few minutes (half an hour).
It will be easier to make the test. I’ll let you know when it’s ready!
Well I figured this must be the case and copied gmic_gimp_qt to my plugin folder and gave it a go.
gmic_gimp_qt:419520): Gtk-WARNING **: 15:35:09.070: Theme parsing error: gtk.css:4:1: '/*' in comment block
/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt: fatal error: Segmentation fault
Terminating plug-in: '/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt'
GIMP-Error: Plug-in crashed: "gmic_gimp_qt"
(/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt)
The dying plug-in may have messed up GIMP's internal state. You may want to save your images and restart GIMP to be on the safe side.
Haa bad news.
So, could you do the same procedure as before, compiling it with the fsanitize=address enabled ?
Also, please check that GIMP actually takes the latest binary of the plug-in, sometimes there are duplicates and it’s not always easy to find which binary it loads.
I think I was chasing my tail for a while. Should I have tried to make clean between builds?
Anyway, I just deleted the entire build directory and tried again with the new gmic.cpp. Here’s what happened.
(gmic_gimp_qt~:442422): Gtk-WARNING **: 16:32:19.546: Theme parsing error: gtk.css:4:1: '/*' in comment block
/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt~: fatal error: Segmentation fault
Terminating plug-in: '/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt~'
GIMP-Error: Plug-in crashed: "gmic_gimp_qt~"
(/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt~)
The dying plug-in may have messed up GIMP's internal state. You may want to save your images and restart GIMP to be on the safe side.
I’m pretty sure I’ve fixed the first issue you got.
It was related to a null pointer, used for a string comparison.
Maybe there are another problem going on.
Again, if you succeed in compiling the stand-alone G’MIC-Qt application, with fsanitize=address enabled, and copy/paste the error log you get from the console, I’ll be able to better understand where the problem comes from, and hopefully fix it.
I’m still a bit surprised about the fact it doesn’t work, but of course, it’s hard to test on all different architectures and compiler versions, so these things may happen from time to time.