Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exception with Custom Drawing Tool after opening Drawing Objects Window

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Exception with Custom Drawing Tool after opening Drawing Objects Window

    Hello,

    I have created a custom drawing tool and during the creation of the object, I pass in certain object references that are then then subsequently released (i.e., set to null) when the drawing tool terminates (State == State.Terminated) for memory management purposes.

    During the normal drawing tool lifecycle, this works fine, including on NinjaScript reload, etc.

    However, if I open the Drawing Objects window, for example to edit another drawing tool such as a Rectangle that I may have manually drawn on the chart, and then click "OK" to commit the changes, then I wind up with a NullReferenceException because the final state of my custom drawing tool following that operation is "Terminated", as opposed to when it is created normally, where the final state is "Active".

    So, in essence what happens is that opening the Drawing Objects window and committing the changes leaves the drawing tool in a Terminated, rather than an Active state on the chart, which means that the required references I passed in have been set to null with then subsequently breaks my handling of move interaction, Render, etc. since I now have on the chart what is ultimately a Terminated, and therefore invalid drawing object.

    I walked through the situation in the debugger to see if there was anything in the state of the drawing tool I could use to avoid or work around this situation, and it doesn't appear that there is anything consistent. Right now, it seems that my only option is to not release the object reference or unsubscribe the event handlers, which I am not very fond of doing.

    Any thoughts?

    #2
    Hi Ninja Support.

    I am just posting a quick rely here, just to make sure this issue does not get forgotten

    Thanks

    Steve

    Comment


      #3
      Hello,

      thank you for the question.

      I wanted to check if you have a sample that can produce the result you are getting. This sounds similar to the explanation of States and Objects at this thread: http://ninjatrader.com/support/forum...743#post451743
      I am unsure if this is related or not because I am unsure what code is being used that is causing the error.

      If you can provide a sample that shows this, I could look more closely at what is happening.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Rapine Heihei, Today, 08:19 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 08:25 PM
      0 responses
      5 views
      0 likes
      Last Post Rapine Heihei  
      Started by f.saeidi, Today, 08:01 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 07:51 PM
      0 responses
      8 views
      0 likes
      Last Post Rapine Heihei  
      Started by frslvr, 04-11-2024, 07:26 AM
      5 responses
      98 views
      1 like
      Last Post caryc123  
      Working...
      X