issue #24469 - try to address xt.lock problems in qt-client

Modularize application locking. This has at least four benefits:
- we might catch some corner cases where locks were left behind by releasing locks in the AppLock destructor
- error reporting should be better so we'll get better diagnostics when lock releasing fails
- if we need to separate qt-client locking from web client locking, we just have to add schema-qualifiers to 2 lines in `common/applock.cpp`
- adding application locks to other objects in qt-client is much easier

Unfortunately, I was not able to reproduce the original problems. If this doesn't fix the bug, it should at least make diagnosing it easier.