|
From: SX L <han...@ho...> - 2020-11-10 04:22:49
|
Hi Eric, Thanks for looking into this issue. Yes, I identified the issue in my windows x64 debug version. The issue could be hard to reproduce since my release version gives me normal exit code. It really depends on the sequence of calling dtors of those shared pointers at exit. So I would suggest moving away from shared pointers in Singletons. Create a singltonDestroyer or use static instances. Get Outlook for Android<https://aka.ms/ghei36> ________________________________ From: Eric Ehlers <eri...@re...> Sent: Monday, November 9, 2020, 11:42 PM To: SX L Cc: qua...@li... Subject: Re: [Quantlib-users] ObservableSettings is deleted early than Observables. Hi Philip, I tried unsuccessfully to recreate the error. You did not say which operating system you are using but you mention "debug version" which sounds like visual studio so I tested it on Windows - I'm using Visual Studio 2019 on 64-bit WIndows 10. I built it using "Debug (static runtime)" x64 and I ran ClientCppDemo and it behaves as I expected (no access violation). Anything else I can try to recreate the error? I have not examined the code but your remarks sound sensible to me. What resolution would you suggest? Regards, Eric On 10/7/20 6:43 AM, SX L wrote: I was trying the Quantlib Addin. The QLADemo exits abnormally in the debug version with an access violation exception. It turned out to be the case that ObervableSettings is deleted earlier than some observer and observables at exit. So in the dtor of the observer, ObservableSettings is called to check if update is deferred, hence causing the exception. I feel it's unsafe to use shared pointers inside a singleton. Any suggestion? Thanks. Regards, Philip Get Outlook for Android<https://aka.ms/ghei36> _______________________________________________ QuantLib-users mailing list Qua...@li...<mailto:Qua...@li...> https://lists.sourceforge.net/lists/listinfo/quantlib-users |