diff --git a/src/core/flameshotdaemon.cpp b/src/core/flameshotdaemon.cpp index 47f38dfc..7099e443 100644 --- a/src/core/flameshotdaemon.cpp +++ b/src/core/flameshotdaemon.cpp @@ -142,6 +142,18 @@ bool FlameshotDaemon::isThisInstanceHostingWidgets() return instance() && !instance()->m_widgets.isEmpty(); } +/** + * @brief Return the daemon instance. + * + * If this instance of flameshot is the daemon, a singleton instance of + * `FlameshotDaemon` is returned. As a side effect`start` will called if it + * wasn't called earlier. If this instance of flameshot is not the daemon, + * `nullptr` is returned. + * + * This strategy is used because the daemon needs to receive signals from D-Bus, + * for which an instance of a `QObject` is required. The singleton serves as + * that object. + */ FlameshotDaemon* FlameshotDaemon::instance() { // Because we don't use DBus on MacOS, each instance of flameshot is its own @@ -159,7 +171,7 @@ FlameshotDaemon* FlameshotDaemon::instance() */ void FlameshotDaemon::quitIfIdle() { - if (m_persist && !instance()) { + if (m_persist) { return; } if (!m_hostingClipboard && m_widgets.isEmpty()) {