From kde-panel-devel Wed Apr 30 14:27:40 2014 From: "Martin Klapetek" Date: Wed, 30 Apr 2014 14:27:40 +0000 To: kde-panel-devel Subject: Review Request 117903: Make notifications plasmoid reuse only 3 Dialogs instead of creating new one Message-Id: <20140430142740.1393.47969 () probe ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=139886807123522 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============1974120771129628819==" --===============1974120771129628819== Content-Type: multipart/alternative; boundary="===============3208093425065402658==" --===============3208093425065402658== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/117903/ ----------------------------------------------------------- Review request for Plasma. Repository: plasma-workspace Description ------- Before, the notifications would create new Dialog for each incoming notification. Now it reuses only 3 Dialogs to save resources. The notification popup is a QML component; I decided to handle all this in the cpp plugin as JS Array is quite crap compared to QList and I had quite some crashes in QV4 on slightly heavier Array processing. But as the QML component needs to talk to the dataengine (like when you close the notification or exectue an action) and uses some methods from the rest of the plasmoid, I can't just instantiate it from the cpp side. So I create the component in QML, pass it to CPP, set the ownership to CPP so it's not deleted ever and then handle it all there. Diffs ----- applets/notifications/package/contents/ui/NotificationPopup.qml 9265352 applets/notifications/package/contents/ui/Notifications.qml 64d80a7 applets/notifications/plugin/notificationshelper.h 1e1f6c2 applets/notifications/plugin/notificationshelper.cpp 1edfbad Diff: https://git.reviewboard.kde.org/r/117903/diff/ Testing ------- Plasma no more leaks memory with every notification (the root memleak, coming from Dialog, is quite possibly still present, but the notifications don't expose it anymore). Notifications work as before, even better. For testing purposes, you can try running for i in {1..10}; do notify-send asasd$i -i kde; done Thanks, Martin Klapetek --===============3208093425065402658== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/117903/

Review request for Plasma.
By Martin Klapetek.
Repository: plasma-workspace

Description

Before, the notifications would create new Dialog for each incoming notification. Now it reuses only 3 Dialogs to save resources.

The notification popup is a QML component; I decided to handle all this in the cpp plugin as JS Array is quite crap compared to QList and I had quite some crashes in QV4 on slightly heavier Array processing. But as the QML component needs to talk to the dataengine (like when you close the notification or exectue an action) and uses some methods from the rest of the plasmoid, I can't just instantiate it from the cpp side. So I create the component in QML, pass it to CPP, set the ownership to CPP so it's not deleted ever and then handle it all there.

Testing

Plasma no more leaks memory with every notification (the root memleak, coming from Dialog, is quite possibly still present, but the notifications don't expose it anymore). Notifications work as before, even better.

For testing purposes, you can try running 

for i in {1..10}; do notify-send asasd$i -i kde; done

Diffs

  • applets/notifications/package/contents/ui/NotificationPopup.qml (9265352)
  • applets/notifications/package/contents/ui/Notifications.qml (64d80a7)
  • applets/notifications/plugin/notificationshelper.h (1e1f6c2)
  • applets/notifications/plugin/notificationshelper.cpp (1edfbad)

View Diff

--===============3208093425065402658==-- --===============1974120771129628819== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============1974120771129628819==--