zeroconf/Avahi: move dbus_shutdown() call to the end of Main()
Calling dbus_shutdown() too early will break the "udisks2" neighbor plugin.
This commit is contained in:
parent
32064a23c1
commit
adf2d3aff2
|
@ -46,6 +46,7 @@ src_mpd_LDADD = \
|
||||||
$(STORAGE_LIBS) \
|
$(STORAGE_LIBS) \
|
||||||
$(PLAYLIST_LIBS) \
|
$(PLAYLIST_LIBS) \
|
||||||
$(AVAHI_LIBS) \
|
$(AVAHI_LIBS) \
|
||||||
|
$(DBUS_LIBS) \
|
||||||
$(LIBWRAP_LDFLAGS) \
|
$(LIBWRAP_LDFLAGS) \
|
||||||
$(SQLITE_LIBS) \
|
$(SQLITE_LIBS) \
|
||||||
$(DECODER_LIBS) \
|
$(DECODER_LIBS) \
|
||||||
|
@ -67,6 +68,8 @@ src_mpd_LDADD = \
|
||||||
libutil.a \
|
libutil.a \
|
||||||
$(SYSTEMD_DAEMON_LIBS)
|
$(SYSTEMD_DAEMON_LIBS)
|
||||||
|
|
||||||
|
src_mpd_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS)
|
||||||
|
|
||||||
src_mpd_SOURCES = \
|
src_mpd_SOURCES = \
|
||||||
src/Main.cxx src/Main.hxx
|
src/Main.cxx src/Main.hxx
|
||||||
|
|
||||||
|
|
10
src/Main.cxx
10
src/Main.cxx
|
@ -101,6 +101,10 @@
|
||||||
#include <systemd/sd-daemon.h>
|
#include <systemd/sd-daemon.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_DBUS
|
||||||
|
#include <dbus/dbus.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
|
@ -713,6 +717,12 @@ try {
|
||||||
IcuFinish();
|
IcuFinish();
|
||||||
|
|
||||||
log_deinit();
|
log_deinit();
|
||||||
|
|
||||||
|
#ifdef ENABLE_DBUS
|
||||||
|
/* free libdbus memory to make memory leak checkers happy */
|
||||||
|
dbus_shutdown();
|
||||||
|
#endif
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
LogError(e);
|
LogError(e);
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#include <avahi-common/malloc.h>
|
#include <avahi-common/malloc.h>
|
||||||
#include <avahi-common/error.h>
|
#include <avahi-common/error.h>
|
||||||
|
|
||||||
#include <dbus/dbus.h>
|
|
||||||
|
|
||||||
static constexpr Domain avahi_domain("avahi");
|
static constexpr Domain avahi_domain("avahi");
|
||||||
|
|
||||||
static char *avahi_name;
|
static char *avahi_name;
|
||||||
|
@ -277,6 +275,4 @@ AvahiDeinit()
|
||||||
|
|
||||||
avahi_free(avahi_name);
|
avahi_free(avahi_name);
|
||||||
avahi_name = nullptr;
|
avahi_name = nullptr;
|
||||||
|
|
||||||
dbus_shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue