davidedmundson added inline comments.

INLINE COMMENTS

> playercontainer.cpp:119
> +    // at the end of its dbus address. This code bit sets 
> "SecondaryInstancePid" to
> +    // <pid> in this case, otherwise it defaults to -1 (for the first one or 
> players
> +    // which don't implement the standard correctly (looking at you VLC 
> [v2.2.2]!)

There is a way to do it which will work for all players much more reliably:

  auto message = QDBusMessage::createMethodCall("org.freedesktop.DBus", "/", 
"org.freedesktop.DBus", "GetConnectionUnixProcessID");
  message.setArguments({m_dbusAddress});
  
  QDBusReply<uint> reply = QDBusConnection::sessionBus().call(message); 

//safe to be blocking as we're calling a method on DBus server not a client, so 
no different from QDBusConnection::connect()

   if (!reply.isError) {
     secondaryInstancePid = reply.value();
  }

REPOSITORY
  R120 Plasma Workspace

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

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: subdiff, #plasma
Cc: davidedmundson, broulik, plasma-devel, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas

Reply via email to