summaryrefslogtreecommitdiff
path: root/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java')
-rw-r--r--platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java b/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java
index e8c6f49f8088..7e613982a406 100644
--- a/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java
+++ b/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java
@@ -50,6 +50,8 @@ class LibNotifyWrapper implements SystemNotificationsImpl.Notifier {
private final LibNotify myLibNotify;
private final String myIcon;
+ private final Object myLock = new Object();
+ private boolean myDisposed = false;
private LibNotifyWrapper() {
myLibNotify = (LibNotify)Native.loadLibrary("libnotify.so.4", LibNotify.class);
@@ -66,14 +68,21 @@ class LibNotifyWrapper implements SystemNotificationsImpl.Notifier {
connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
@Override
public void appClosing() {
- myLibNotify.notify_uninit();
+ synchronized (myLock) {
+ myDisposed = true;
+ myLibNotify.notify_uninit();
+ }
}
});
}
@Override
public void notify(@NotNull Set<String> allNames, @NotNull String name, @NotNull String title, @NotNull String description) {
- Pointer notification = myLibNotify.notify_notification_new(title, description, myIcon);
- myLibNotify.notify_notification_show(notification, null);
+ synchronized (myLock) {
+ if (!myDisposed) {
+ Pointer notification = myLibNotify.notify_notification_new(title, description, myIcon);
+ myLibNotify.notify_notification_show(notification, null);
+ }
+ }
}
}