Setting null on OnFinish in Graph.cs

NodeCanvas Forums Support Setting null on OnFinish in Graph.cs

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11429
    tomas.trescak
    Participant

    Hi. What is the reason for setting null to OnFinish in Graph.cs? It wreaks havoc to my app, when I restart the graph in the OnFinish callback, the graph will never announce its completion as it overrides the OnFinish with null after the graph is started.

    if (OnFinish != null){
    OnFinish(success);
    OnFinish = null;
    }

    #11431
    tomas.trescak
    Participant

    Would you consider changing it to:

    if (OnFinish != null){
    var finishCallback = OnFinish;
    OnFinish = null;
    finishCallback (success);
    }

    #11433
    Gavalakis
    Keymaster

    Hello Tomas,

    Hmm. The OnFinish callback is really meant for one-off callbacks. What is the different of your suggestion above vs simply calling OnFinish and then setting it null? Maybe I am missing something here, but can you please explain more specifically what/when is the issue? 🙂

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.