SetLicenseCallback to nullptr - yea or nay?


#1

I’m making use of LexActivator’s SetLicenseCallback to get notified when a server sync has happened. However, I’m only interested in the very 1st server sync notification.

Is it OK if I call SetLicenseCallback(nullptr) at the end of my callback function to prevent any callbacks being done? Or might this lead to undefined behavior in the LexActivator library? So far it seems to work without crashing anything, but this isn’t documented either, so I’m a bit uneasy putting it in production code.


#2

Hi Carl,

I think setting this to null is fine unless you don’t do it in the callback itself.

Regards,
Adnan


#3

Hi Adnan,

Thanks for that!
I’m setting it to nullptr at the end of the callback (just before returning from it), and indeed nothing seems to be crashing, also not when the time is right for the callback to be called again, so it seems to be handled OK.