



UPDATE: Since posting this, I've now made a pure ASPiK (no RackAFX) plugin, VST3, and the same thing happens: Entering invalid data into an exit box that expects numerical data crashes my host (in my case, Reaper).
Hi,
I would like to report what might be a bug in RackAFX:
When I load a custom GUI, through View => Custom Plugin GUI, and I double click an edit box that's connected to a plugin parameter (in my case part of a knob group), when I then enter an invalid value, e.g. an non-numerical character or string rather than a number, and press enter, RackAFX as a whole crashes without warning.
I take it this is because RackAFX will try to convert that non-numerical string into a number?
So either that conversion would need to be surrounded by a try-catch or something, or maybe entering non-numerical data should be prohibited?
In the RackAFX design panel I notice entering non-numerical characters isn't possible, which I feel would be the best option.
I haven't tried building a VST plugin yet to see what happens there, but I suspect behaviour might be the same.
Will, many thanks again for the great work you're doing

This is an issue in the plugingui.cpp file in the valueChanged function. In RackAFX, there is extra information available to the prototyping object (from the .prj file) so it can treat the edit control differently depending on the kind of parameter.
I can add a fix for this in the new ASPiK/RackAFX but you can also patch it yourself if you want.
In plugingui.cpp at line 1551 you can find this chunk of code:
if (receiver)
{
// --- need to handle labels (or edits) differently
CTextLabel* label = dynamic_cast<CTextLabel*>(pControl);
if (label)
{
std::string strLabel(label->getText());
actualValue = stof(strLabel);
The crash is happening from the stof( ) function call (that does not check to see if the text is numerical or not).
actualValue = stof(strLabel);
You would need to insert code before that call that checks the text. And, there is no cut-and-dried way to do that, but there are some options you can find here:
https://stackoverflow.com/questions/4654636/how-to-determine-if-a-string-is-a-number-with-c
Will


Hi Will,
Thanks for your reply
I solved it by doing this:
try {
actualValue = stof(strLabel);
} catch (...) {
return;
}
In other words, a very broad sweep, catching any possible error, and bailing out if there is one.
I am the least proficient C++ person I know: even though I am a programmer, I know next to nothing about C++.
However, this seems to work very well.
Kindest regards,
Matt


Matt said
Hi Will,Thanks for your reply
I solved it by doing this:
try {
actualValue = stof(strLabel);
} catch (...) {
return;
}
In other words, a very broad sweep, catching any possible error, and bailing out if there is one.
I am the least proficient C++ person I know: even though I am a programmer, I know next to nothing about C++.
However, this seems to work very well.
Kindest regards,
Matt
![]()
Hi Matt,
Thanks for sharing this
Could you please correct me if I understood well the fix?
if (receiver)
{
// --- need to handle labels (or edits) differently
CTextLabel* label = dynamic_cast<CTextLabel*>(pControl);
if (label)
{
std::string strLabel(label->getText());
try {
actualValue = stof(strLabel);
} catch (...) {
return;
}
Thanks,
Holder


studentcode said
Hi Matt,
Thanks for sharing this
Could you please correct me if I understood well the fix?
if (receiver)
{
// --- need to handle labels (or edits) differently
CTextLabel* label = dynamic_cast<CTextLabel*>(pControl);
if (label)
{
std::string strLabel(label->getText());
try {
actualValue = stof(strLabel);
} catch (...) {
return;
}
Thanks,
Holder
That is 100% correct
Most Users Ever Online: 152
Currently Online:
6 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Chaes: 49
Skyler: 48
Derek: 46
Frodson: 45
Peter: 43
TheSmile: 43
clau_ste: 39
jim: 34
JimmyM: 33
Gwen: 32
Member Stats:
Guest Posters: 1
Members: 677
Moderators: 1
Admins: 5
Forum Stats:
Groups: 13
Forums: 41
Topics: 740
Posts: 2835
Newest Members:
bmarx, Tom Helvey, Ludovic, Mihir Shah, Mina, robbie, Matteo Desantis, jacobwotson, Nowhk, reynaldo_fmModerators: W Pirkle: 550
Administrators: Tom: 74, JD Young: 80, Will Pirkle: 0, W Pirkle: 550, VariableCook: 3