mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-02-14 06:24:02 +00:00
Fix daemon persist bug and document instance() (#2185)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user