Setting null on OnFinish in Graph.cs

Forums 💬 NodeCanvas ⚙️ Support Setting null on OnFinish in Graph.cs

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18351
    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;
      }

      #18353
      tomas.trescak
      Participant

        Would you consider changing it to:

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

        #18352
        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!

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