Fix trying to disconnect null PulseContext when reloading config. Fixes #231

This commit is contained in:
Erik Reider 2023-03-05 13:20:54 +01:00
parent 024b370a21
commit 74d6353e97
2 changed files with 9 additions and 4 deletions

View File

@ -8,7 +8,7 @@ namespace SwayNotificationCenter.Widgets {
* https://github.com/elementary/switchboard-plug-sound
*/
public class PulseDaemon : Object {
private Context context;
private Context? context;
private GLibMainLoop mainloop;
private bool quitting = false;
@ -33,8 +33,14 @@ namespace SwayNotificationCenter.Widgets {
public void close () {
quitting = true;
context.disconnect ();
context = null;
if (this.context != null) {
context.disconnect ();
context = null;
}
}
~PulseDaemon() {
this.close ();
}
public signal void change_default_device (PulseDevice device);

View File

@ -25,7 +25,6 @@ namespace SwayNotificationCenter.Widgets {
});
}
public Volume (string suffix, SwayncDaemon swaync_daemon, NotiDaemon noti_daemon) {
base (suffix, swaync_daemon, noti_daemon);