Closed PhilLab closed 5 years ago
You are totally right! I did a quick fix: (https://github.com/mohabouje/WinToast/commit/f020f6f2c318700765024454cc32f3c6be08ad8c). Now, the code should run correctly and the destructor is called at the end of the program execution.
@mohabouje I applied your changes and now my program crashes on exit in the WinToast destructor at _xmlDocument.Reset();
. But only if I previously showed a notification somewhere. If not, the program exits normally. Do you have the same problem?
Aside from that, the .Reset()
is not needed as the object are smart pointers which release on their destructor. But unfortunately the _xmlDocument destructor crashes
@mohabouje I had to revert the change because otherwise this library's current HEAD is not usable anymore. Can you confirm that it workes on your machine?
I will try to figure out how to replicate your problems. I'm not able to debug the problema, I use the library in different projects and it works fine.
Finally, I find the problem. I was looking in to the new Microsoft Examples and how they fix it. I just limited the scope of the different ComPtr. I did some clean and tested it in Windows 8 & 10. It seems to work fine, Can you confirm @PhilLab ??
Thanks for looking into it. How did you make it work if initialize() always return false?.
If I fix this (setting to return true
), I can't show notifications from different threads than the one I first instantiated the lib with - unfortunately, this is necessary in my architecture.
It was a mistake to return a false in initialise function. It was reported here, and fixed https://github.com/mohabouje/WinToast/issues/24
About the problem you explain, I had the same problem in the past, what I did is to create different instance using the normal constructor and avoiding the singleton. If all the different threads use the same AUMI, then it should work without problem.
The destructor Sets to null and then deletes, which makes no sense. Aside from that, I don't understand when the destructor is ever called and if the (instance) destructor should really delete the static member