When a wrong password is set for a given document, LibreOffice will continuously send password requests until the document is loaded (inside callbacks): This can essentially trigger infinite loops.
There's no way to disable or remove the previously registered callback
There's no way to bubble up an error so that LibreOffice stops asking for a password (without "segfaulting" an application)
Description of proposed solution
Approach
A solution is to introduce an unset_document_password method that sets the password to a null pointer for a given URI.
This new method also needs to be invoked within callbacks similarly to set_document_password
The new method only needs to be called once, even though subsequent calls don't appear to have unintended side-effects
Other considerations
It appears that LibreOfficeKit does not expose synchronization methods required for callback invocation("notify" for waiting locks/monitors). Even if you properly set or unset a password, you might get few additional "meaningless callbacks".
If the original password was valid and you get a second callback where you call unset_document_password, there will be no impact, LibreOffice seems to maintain thread-local variables internally.
If the original password was invalid and you unset the password, you can safely ignore subsequent callbacks. After 2-6 additional callback invocations, LibreOffice will "somehow realize" that the password was unset and the callbacks will stop
Problem statement
When a wrong password is set for a given document, LibreOffice will continuously send password requests until the document is loaded (inside callbacks): This can essentially trigger infinite loops.
Description of proposed solution
Approach
A solution is to introduce an
unset_document_password
method that sets the password to a null pointer for a given URI.set_document_password
Other considerations
It appears that
LibreOfficeKit
does not expose synchronization methods required for callback invocation("notify" for waiting locks/monitors). Even if you properly set or unset a password, you might get few additional "meaningless callbacks".unset_document_password
, there will be no impact, LibreOffice seems to maintain thread-local variables internally.