Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions panels/notification/osd/audio/audioapplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ QString AudioApplet::fetchIconName() const
level = "100";
else if (volume > 1)
level = "more";
else
return "osd_volume_mute";

return QString("osd_volume_%1").arg(level);
}
Expand Down
15 changes: 15 additions & 0 deletions panels/notification/server/dbusadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include "dbusadaptor.h"
#include "notificationmanager.h"

#include <QDBusConnection>

Check warning on line 8 in panels/notification/server/dbusadaptor.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusConnection> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusMessage>

Check warning on line 9 in panels/notification/server/dbusadaptor.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusMessage> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QLoggingCategory>

Check warning on line 10 in panels/notification/server/dbusadaptor.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QLoggingCategory> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QTimer>

Check warning on line 11 in panels/notification/server/dbusadaptor.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTimer> not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace notification {
Q_DECLARE_LOGGING_CATEGORY(notifyLog)
Expand All @@ -30,6 +31,20 @@
const QString &body, const QStringList &actions, const QVariantMap &hints,
int expireTimeout)
{
// Delay processing for 3 seconds when appIcon == "deepin-screen-recorder"
if (appIcon == "deepin-screen-recorder") {
// Use QTimer to delay processing asynchronously without blocking other notifications
QTimer::singleShot(3000, this, [this, appName, replacesId, appIcon, summary, body, actions, hints, expireTimeout]() {
uint id = manager()->Notify(appName, replacesId, appIcon, summary, body, actions, hints, expireTimeout);
if (id == 0) {
QDBusError error(QDBusError::InternalError, "Notify failed.");
QDBusMessage reply = QDBusMessage::createError(error);
QDBusConnection::sessionBus().send(reply);
}
});
Comment on lines +35 to +44
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Delaying Notify via QTimer breaks D-Bus method-call semantics and may confuse clients

Notify now always returns 1 immediately, while the real notification (which may fail or get a different ID) is created up to 3 seconds later. The async error you send is not associated with the original D-Bus method call, so clients will see a successful reply with ID 1 even when manager()->Notify(...) fails or chooses another ID, breaking D-Bus method semantics and potentially causing timeouts or inconsistent client behavior. If a delay is needed, keep the D-Bus call synchronous with the actual Notify result (e.g., perform the delay inside manager()->Notify or a deeper layer, or use an internal queue/timer while still returning the final ID synchronously).

return 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种是bubbleId,对调用方是有用的,
不应该这样去延迟,

}

uint id = manager()->Notify(appName, replacesId, appIcon, summary, body, actions, hints, expireTimeout);
if (id == 0) {
QDBusError error(QDBusError::InternalError, "Notify failed.");
Expand Down