Revision e7d1459...

Go back to digest for 13th January 2013

Bug Fixes in Development Tools

Milian Wolff committed changes in [kdevplatform/itemrepository] /:

Fix, refactor and cleanup the session locking mechanism.

This is especially needed to break the cyclic dependency between
language and shell which was introduced by the requirement to
call SessionController::tryLockSession from the ItemRepositoryRegistry.

This commit introduces a RAII ISessionLock that is implemented by
shell/sessionlock.{cpp,h}. This lock is passed around as a shared
pointer. All potentially dangerous code paths now take such a
ISessionLock::Ptr argument to verify that the session is properly
locked.

Such a little change, yet it had quite an aftermath... The fix made
it neccessary to refactor lots of other code paths, especially the
crude SessionController::LockSessionState is gone and replaced by
three new classes:

SessionRunInfo, which holds the information about whether a session
is running and if so, what the app's PID and name is.

ISessionLock::Ptr which ensures that a session is actually locked.

TryLockSessionResult (bad name, suggestions?) which holds both,
a SessionRunInfo and a ISessionLock::Ptr. If the latter is non-null
it means that the session was locked. Otherwise the SessionRunInfo
can be queried for why this was not the case.

In addition to that we now also have some more readable API in the
SessionController, most notably isSessionRunning and sessionRunInfo.

Oh and did I mention that I introduced some more unit tests? Yay!

Note that I also removed quite some dead code, most notably in what
was formerly SessionController::handleSessionLocked. The information
about stale lock files and such should never be shown as only the
DBUSLock is actually relevant. The KLockFile is only used to find
the PID + app name of whoever is responsible for locking a given
session ID.

Futhermore I have to say that we should decide on whether to use
QUUid or QString in our API as the type for our Session IDs...
Right now we use a mixture of both but actually rely on QUUid in
dBusServiceNameForSession()...

Finally I also moved the stupid SessionDialog into its own files
but that should be completed and further cleaned up...

File Changes

Added 6 files
  •   interfaces/isessionlock.cpp
  •   interfaces/isessionlock.h
  •   shell/sessionchooserdialog.cpp
  •   shell/sessionchooserdialog.h
  •   shell/sessionlock.cpp
  •   shell/sessionlock.h
Modified 14 files
  •   interfaces/CMakeLists.txt
  •   interfaces/icore.h
  •   shell/CMakeLists.txt
  •   shell/core.cpp
  •   shell/core.h
  •   shell/session.cpp
  •   shell/session.h
  •   shell/sessioncontroller.cpp
  •   shell/sessioncontroller.h
  •   language/duchain/duchain.cpp
  •   shell/tests/sessioncontrollertest.cpp
  •   shell/tests/sessioncontrollertest.h
  •   language/duchain/repositories/itemrepositoryregistry.cpp
  •   language/duchain/repositories/itemrepositoryregistry.h
20 files changed in total