<table><tr><td style="">tobiasdeiminger created this revision.<br />Herald added a project: Okular.<br />Herald added a subscriber: okular-devel.<br />tobiasdeiminger requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15574">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>We request a inhibit lock of DBus type UNIX_FD from systemd logind. It's wrapped into (and owned by) a QDBusUnixFileDescriptor object of automatic storage. The file descriptor will be closed in QDBusUnixFileDescriptor Dtor, and may be reused by some other facility (e.g. pulseaudio).</p>
<p>If we want to store the lock longer than QDBusUnixFileDescriptor lifetime, we have to dup the file descriptor. If we don't dup, and close the original fd later in PresentationWidget::allowPowerManagement, bad things may happen.</p>
<p>Besides that, what we get from systemd is really a file descriptor, not a "cookie". So I renamed the m_sleepInhibitCookie to m_sleepInhibitFd and changed initial state to -1 accordingly.</p>
<p>BUG 393478<br />
BUG 398720</p></div></div><br /><div><strong>TEST PLAN</strong><div><ul class="remarkup-list">
<li class="remarkup-list-item">bugs don't occur any longer</li>
<li class="remarkup-list-item">inhibiting sleep during presentation mode still works</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>BRANCH</strong><div><div>fix_dbus_fd</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15574">https://phabricator.kde.org/D15574</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>ui/presentationwidget.cpp<br />
ui/presentationwidget.h</div></div></div><br /><div><strong>To: </strong>tobiasdeiminger<br /><strong>Cc: </strong>okular-devel, ngraham, aacid<br /></div>