samj
(samj)
November 13, 2024, 2:48pm
1
@David_Tschumperle
The bug issue with QT6 is identical to the one described here:
@David_Tschumperle
Bonjour,
Gradient [Custom Shape]
This Gui setting causes a sudden shutdown (bug) of the plugin with QT6 Gimp 3.0.0-rc1 compilation:
#@gui :Save Gradient As=_text(“”)
This change removes this problem (adding a character):
#@gui :Save Gradient As=_text(" ")
In all cases this parameter gives no results, including in old versions of GMIC-QT-GIMP.
Merci.
:o)
With problem:
#@gui :New Filters=text(1,“”)_0
#@gui :Removed Filters=text(1,“”)_0
Just change the typography, no problem:
#@gui :New Filters=text(1," ")_0
#@gui :Removed Filters=text(1," ")_0
:o)
That’s interesting indeed.
It seems to be a bug in the G’MIC-Qt code. I guess that it should be fixed directly in the C++ code of G’MIC-Qt rather than doing some tricks on the filter definition to avoid the bug.
Clearly, the plug-in should be able to handle empty string correctly.
That probably needs a fix in gmic-qt/src/FilterParameters/TextParameter.cpp at master · GreycLab/gmic-qt · GitHub
1 Like
The right way to handle this, in my opinion :
Compute the G’MIC-Qt stand-alone version with the debug flags activated (like -fsanitize=address
), then run G’MIC-Qt stand-alone from the command-line, and makes it crash.
There should be now a log on the console about the code line that caused the crash, then see if this is possible fix and where (where it is happening is particularly important).
samj
(samj)
November 13, 2024, 5:56pm
4
Thanks for directing me to this link.
I will do some testing and let you know my results.
It may take a long time…
:o)
1 Like
Thanks @samj , take your time, because in any case, I won’t be able to fix the bug by myself (I don’t have Qt-6 installed). I suspect this is a minor bug that requires a minor fix.
But it’s better to take the time to correct it as cleanly as possible.
samj
(samj)
November 13, 2024, 7:30pm
6
Here is the result when testing What’s New? and Gradient [Custom Shape]
In both cases the problem is the same and the fault comes from the same line:
_value = _default = unescaped(unquoted(value));
I don’t really understand re(“^\s*(0|1)\s*,”) to make corrections
The documentation QRegularExpression Class | Qt Core 6.8.0
Le programme de test du fichier TextParameter.cpp
bool TextParameter::initFromText(const QString & filterName, const char * text, int & textLength)
{
QStringList list = parseText(“text”, text, textLength);
if (list.isEmpty()) {
return false;
}
_name = HtmlTranslator::html2txt(FilterTextTranslator::translate(list[0], filterName));
QString value = list[1];
_multiline = false;
QRegularExpression re(“^\s*(0|1)\s*,”);
auto match = re.match(value);
if (match.hasMatch()) {
_multiline = (match.captured(1).toInt() == 1);
value.replace(re, “”);
}
_value = _default = unescaped(unquoted(value)); // C’EST CE QUI PROVOQUE LE BOGUE AVEC QT6
return true;
}
Thanks, that was fast!
value
is probably an undefined QString and either unquoted
or unescaped
does not handle it correctly.
Could you just try replace unquoted(value)
by value
and see if this works.
And if it doesn’t, replace unescaped(value)
by value
?
samj
(samj)
November 13, 2024, 8:43pm
8
Here are the results of my tests:
_value = _default = unescaped(unquoted(value)); // ORIGINE, NE FONCTIONNE PAS
_value = _default = unescaped(value); // FONCTIONNE AVEC What’s New? MAIS PAS BIEN AVEC Gradient [Custom Shape] voir erreur value.png
_value = _default = (value); // FONCTIONNE AVEC What’s New? MAIS PAS BIEN AVEC Gradient [Custom Shape] voir erreur value.png
_value = _default = unquoted(value); FONCTIONNE AVEC What’s New? et AVEC Gradient [Custom Shape] :o)
value.png
1 Like
Thanks Sylvie,
So what happens if you modify function QString unescaped(const QString & text)
like this, in file src/Misc.cpp
:
QString unescaped(const QString & text)
{
QByteArray ba = text.toUtf8();
if (ba.data() && *ba.data()) gmic_library::cimg::strunescape(ba.data());
return QString::fromUtf8(ba.data());
}
Does it solve the issue ?
samj
(samj)
November 13, 2024, 10:01pm
10
With these 2 options:
_value = _default = unescaped(unquoted(value));
and
QString unescaped(const QString & text)
{
QByteArray ba = text.toUtf8();
if (ba.data() && *ba.data()) gmic_library::cimg::strunescape(ba.data());
return QString::fromUtf8(ba.data());
}
both filters work.
I will do more in-depth testing of the other filters tomorrow.
Merci
:o)
1 Like
samj
(samj)
November 13, 2024, 11:40pm
11
@David_Tschumperle
GMIC-QT-GIMP-3.0.0-RC1 W64:
I tested all filters with the GUI and there was no hard stop (bug) with the latest change. It’s great!
:o)
1 Like
samj
(samj)
November 14, 2024, 11:08am
12
‘What’s New?’ filter works correctly under GMIC-QT and GMIC-QT-GIMP-3.0.0rc1 W64.
The change is:
committed 10:44PM - 13 Nov 24 UTC
:o)
1 Like