Fixed an issue where clementine could crash: A client connects before the playlist manager is

initialized. This caused a null pointer exception. Now the server is started after the
playlist manager was initialized.
This commit is contained in:
Andreas 2013-01-22 22:58:32 +01:00
parent 0828115c74
commit 78ad2fb517
3 changed files with 11 additions and 2 deletions

View File

@ -108,8 +108,11 @@ Application::Application(QObject* parent)
network_remote_ = new NetworkRemote(this);
MoveToNewThread(network_remote_);
// This must be before libraray_->Init();
// In the constructor the helper waits for the signal PlaylistManagerInitialized
// to start the remote. Without the playlist manager clementine can
// crash when a client connects before the manager is initialized!
network_remote_helper_ = new NetworkRemoteHelper(this);
network_remote_helper_->StartServer();
library_->Init();

View File

@ -33,6 +33,10 @@ NetworkRemoteHelper::NetworkRemoteHelper(Application* app)
connect(this, SIGNAL(SetupServerSig()),
app_->network_remote(), SLOT(SetupServer()));
// Start the server once the playlistmanager is initialized
connect(app_->playlist_manager(), SIGNAL(PlaylistManagerInitialized()),
this, SLOT(StartServer()));
sInstance = this;
}

View File

@ -13,9 +13,11 @@ public:
NetworkRemoteHelper(Application* app);
~NetworkRemoteHelper();
void StartServer();
void ReloadSettings();
private slots:
void StartServer();
signals:
void SetupServerSig();
void StartServerSig();