1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36:34 +01:00

[QtSingleApplication] Correctly remove lockfile only on app close.

Fixes regression when multiple instances of browser were opened.
This commit is contained in:
nowrep 2013-04-04 23:33:02 +02:00
parent 7c57588738
commit 43d514a647
6 changed files with 13 additions and 2 deletions

View File

@ -178,6 +178,10 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
return res;
}
void QtLocalPeer::removeLockedFile()
{
lockFile.remove();
}
void QtLocalPeer::receiveConnection()
{

View File

@ -68,6 +68,7 @@ public:
bool sendMessage(const QString &message, int timeout);
QString applicationId() const
{ return id; }
void removeLockedFile();
Q_SIGNALS:
void messageReceived(const QString &message);

View File

@ -123,7 +123,5 @@ QtLockedFile::~QtLockedFile()
if (isOpen()) {
unlock();
}
remove();
}

View File

@ -277,6 +277,11 @@ QWidget* QtSingleApplication::activationWindow() const
return actWin;
}
void QtSingleApplication::removeLockedFile()
{
peer->removeLockedFile();
}
/*!
De-minimizes, raises, and activates this application's activation window.

View File

@ -84,6 +84,8 @@ public:
void initialize(bool dummy = true)
{ isRunning(); Q_UNUSED(dummy) }
void removeLockedFile();
public Q_SLOTS:
bool sendMessage(const QString &message, int timeout = 5000);
void activateWindow();

View File

@ -747,6 +747,7 @@ void MainApplication::quitApplication()
//
// * this can occur on Mac OS (see #157)
removeLockedFile();
quit();
}