Emitting Signal with multiple arguments


ROOT Version: 6.16/00
Platform: Ubuntu 18.04
Compiler: 7.3.0


Hi guys!
When emitting a Signal with multiple arguments ROOT throws following Error:

Error in <TClingCallFunc::exec>: Not enough arguments provided for SetValue (1 instead of the minimum 2)

To demonstrate the problem I modified a trivial Signal/Slot example from the “Writing GUI” chapter (link to original example here). Simply instead of using one parameter in the Emit() function I used two. Here is the link to a Gist that reproduces the error: https://gist.github.com/petrstepanov/4e0b8cd79526440438e40369ae4d09a5

P.S. There is a typo in documentation here. Apparently, in line:
args[0]=(Long_t)processor->GetValue(2);
array argument has to be [1].

Hi,

If you look at the Emit() [1/2] method in the TQObject class reference, you can read:

So to solve your issue, simply use an array of Long_t:

    // Emit pair of values
    Long_t args[2];
    args[0] = (Long_t)fValue1;
    args[1] = (Long_t)fValue2;
    Emit("SetValue(Int_t, Int_t)", args);

Thanks for the report, it is fixed in the master and will be visible online soon.

Cheers, Bertrand.

Yikes. My bad. Thank you so much again!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.