D16425: Added new Suspend then Hibernate option

Ambareesh Balaji noreply at phabricator.kde.org
Tue Jun 4 05:11:46 BST 2019


abalaji added inline comments.

INLINE COMMENTS

> suspendsessionconfig.cpp:122
> +    int comboBoxMaxWidth = 300;
> +    if (m_suspendThenHibernateEnabled) {
> +        comboBoxMaxWidth = qMax(comboBoxMaxWidth, m_suspendThenHibernateEnabled->sizeHint().width());

After doing the above, this if block can be merged with the above if block, if you know what I mean.

> avaldes wrote in suspendsessionconfig.cpp:106
> Done on purpose to change the UI:
> 
> F6822188: suspendThenHibernate.png <https://phabricator.kde.org/F6822188>
> 
> Automatically, m_comboBox, m_idleTime

Oh i see, that actually makes sense

> avaldes wrote in suspendsessionconfig.cpp:121
> yeah it's necessary, without it powerdevil crashes at launch

Yeah it crashes because you're probably not doing a null check somewhere. I would suggest initializing `m_suspendThenHibernateEnabled ` to nullptr in the ctor, moving line 79 into this if block right above, and getting rid of this else block altogether, that way you don't wastefully allocate the object. After this, check for nullptr in every place you use `m_suspendThenHibernateEnabled`.

REPOSITORY
  R122 Powerdevil

BRANCH
  arcpatch-D16425_1

REVISION DETAIL
  https://phabricator.kde.org/D16425

To: avaldes, broulik, ngraham
Cc: jobauer, reverendhomer, meven, soriano, abalaji, graesslin, ngraham, plasma-devel, ericadams, jraleigh, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190604/7811a0af/attachment.html>


More information about the Plasma-devel mailing list