OnInit() execution fail - page 2

 

Now that I was told, that it`s a 1000% matter of my code, so I would like to know how to figure out which part.

The debugger does not even execute OnInit(), as written in the beginning and in the title. OnDeinit() is executed, but in case of EAs, this is the last code before the next OnInit(), no destructors are executed in EAs afterwards, no vars are initialized. In other words: There is a black hole between OnDeinit() and OnInit(). Any hints where to search and where to start to search? And by the way, I also develop with VC# and my experience lasts back >30 years, back to MASM and very first versions of C++. I never saw anything like this. When a debugger of a high level code stops it´s execution, it's not a matter of the code, it´s a matter of the debugger. 

 
Put a break point in your OnInit and debug your code. Stop asking us, we can't see your broken code.
 
William Roeder:
Put a break point in your OnInit and debug your code. Stop asking us, we can't see your broken code.

OnInit() ist not executed, breakpoint is never reached, cause MT crashes between OnDeinit() and OnInit(). Great that everybody is ignoring this fact :D 

I am looking for hints from people who tracked already the same behavior in other circumstances. 

 
Then you know the problem is your global/static variables. Comment them out and find out why.
 
William Roeder:
Then you know the problem is your global variables. Comment them out and find out why.

Thanks for the hint. But global objects and vars are initialized only once in EAs, before OnInit() is processed the first time. But the problem occurs when the timeframe is changed. In such case, OnDeinit() directly leads to OnInit() again, or is there something in between what I overlooked?

 

My suspicion is another.

This happens ONLY when I switch from a higher timeframe to a lower, never vice versa, and the bigger the step, the higher the chance to crash. From W1 to M1, the chance is 100%. From M5 to M1 it almost never crashes. 

I am using a bitmap label object to draw stuff in the chart, this bitmap is as big as the chart is and my resolution is 5K. I am not sure, but I think I saw, that MT stretched the bitmap when the timeframe was switched before it crashed. The problem is, that Windows freezes entirely and its almost impossible to catch this visually, maybe by a camera, yes. But, if this happens, this would explain the behavior. Because, if MT would really enlarge the bitmap by a factor of 3.600 when switching from D1 to M1 accidentally, it would allocate too much memory and this could cause the crash. I will try to delete the bitmap before the timeframe is changed and see what happens then. This would also explain, that it makes no difference if I stop execution of any code before and after a change of a timeframe, this is what I tried already and I mentioned this, that I can reproduce this without any executed code. 

 

Dude you're a broken record. There's also an article, "How to Answer Questions the Smart Way", ya know.