-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash in WinToast destructor #44
Comments
@rrrado do you know any steps that may help me to reproduce the problem? I am not able to reproduce it. I guess is not the same problem but a few months ago, we had a similar problem. The application was calling I will take a look and try to figure out how to deal with this issue. |
@mohabouje I'm sorry, I cannot reproduce it. I've tried to close the application while notification was shown, but it didn't crash. I don't really know how does WinToast work internally (I was never working with WinRT) but according to call stack it looks like there were some outdated notification interfaces in the _buffer at the time of application exit. |
I can reproduce this bug in the console-example.exe
When the notification expires the program crushes. |
It's possible that the handle is expiring before the toast has expired hence the crush |
Any updates on this issue? |
For me, it's crashing if you exit the app with a toast on screen. I keep a list of toasts on screen and hide them in my destructor. That seems to work around the crash.
|
I've modified destructor to swallow the access violation. It's dirty but it seems it works for me.
|
I use WinToast along with Qt and this crash occurs on exit because destructor is called after destruction of QApplication. |
Hi, For what it is worth, I had a very similar COM-based singleton class (completely different COM lib) that called CoUninitialize in its destructor and it suffered from similar issues. I used it in console apps and believe that it MAY be related to the destructor being called from a different thread than the one in which it was created (even in a single-threaded app). But I'm not totally sure that was why it happened. I tried everything I could think of or research and concluded the only alternative was to, like sevoster, call a deinitializer function from the same thread that calls ConInitialize. I also found I had to sleep for 250-500 ms after calling CoInitialize or I sometimes got an error. I just thought I'd share this. |
I think I've found problem - at least in my case. I have MFC application and I'm calling AfxOleTerm() which calls CoUninitialize internally in my ExitInstance(). Unfortunately ~WinToast() destructor is called AFTER this so it crashes. I'm not sure it is fortunate to have uninitialization in singleton's destructor, because it is typically called very late after typical application already called CoUninitialize() IMHO. |
rrrado's solution is working for me as well. |
Sometimes users reports crash while closing the application. I cannot reproduce the problem by myself it seems to be random and not very often. The call stack looks always like this:
The text was updated successfully, but these errors were encountered: