-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory usage improvements #3
Conversation
m_id(id) | ||
{ | ||
PWSTR appID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deleted code here has been moved to DesktopNotificationsManager.cpp
@@ -2,109 +2,29 @@ | |||
#include "DesktopNotificationsManager.h" | |||
#include <iostream> | |||
|
|||
typedef ABI::Windows::Foundation::ITypedEventHandler< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deleted code here has been moved to DesktopNotificationsManager.h
{ | ||
m_appID = std::wstring(appID); | ||
CoTaskMemFree(appID); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block comes from DesktopNotification.cpp
return nativeHistory; | ||
} | ||
return {}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was literally moved here from the top of the file, no changes.
@@ -193,3 +212,86 @@ bool DesktopNotificationsManager::closeNotification(ComPtr<DesktopNotification> | |||
DN_LOG_ERROR("Notification " << d->getID() << " does not exist"); | |||
return false; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole 🟢 block was brought from DesktopNotification.cpp
, and then I added some changes to obtain the notification ID and send it with the callback.
|
||
return E_NOINTERFACE; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block comes from DesktopNotification.h
This comment was marked as spam.
This comment was marked as spam.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two suggestions, neither blocking. I understand maybe 10% of the cpp code in here but I cam away with a renewed appreciation of having you on my team 😄
return | ||
} | ||
|
||
if (event === 'click') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we can't even be sure that the notification is dismissed if it's clicked? Can it still live on in the notification center?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can, yeah! Before this PR, I had some SEGFAULT crashes trying to remove the notification and its callback from memory right after the click
event. Then I forgot to do that. I'll tackle that in a different PR along with other minor improvements I want to do.
Co-authored-by: Markus Olsson <j.markus.olsson@gmail.com>
This PR makes a few changes around memory usage. But first, some context:
The changes made in this PR are: