SessionLock: assert valid session id string
The default string representation of a QUuid is enclosed in curly braces. dBusServiceNameForSession() calls QStringView::mid() assuming such a default UUID string representation. One of the callers of this function - SessionLock::handleLockedSession() - does always pass the result of a QUuid::toString() call. The other two callers of dBusServiceNameForSession() apparently assume the same session id string format. QStringView::mid() will be ported to QStringView::sliced() once KDevelop depends on Qt 6. The behavior is undefined if the second argument to sliced() is negative. Assert the string format assumption in dBusServiceNameForSession() to better document it and catch a potential bug earlier.
Loading
Please register or sign in to comment