mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 10:35:10 +00:00
Quick fix for crashes when mpd stops
This commit is contained in:
parent
f0d0a03b8e
commit
38f05de4ca
@ -484,10 +484,12 @@ void mpd_clearError(mpd_Connection *connection)
|
|||||||
|
|
||||||
void mpd_closeConnection(mpd_Connection *connection)
|
void mpd_closeConnection(mpd_Connection *connection)
|
||||||
{
|
{
|
||||||
closesocket(connection->sock);
|
if (connection) {
|
||||||
free_and_zero(connection->returnElement);
|
closesocket(connection->sock);
|
||||||
free_and_zero(connection->request);
|
free_and_zero(connection->returnElement);
|
||||||
free(connection);
|
free_and_zero(connection->request);
|
||||||
|
free(connection);
|
||||||
|
}
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,7 +701,7 @@ static void mpd_getNextReturnElement(mpd_Connection *connection)
|
|||||||
|
|
||||||
void mpd_finishCommand(mpd_Connection *connection)
|
void mpd_finishCommand(mpd_Connection *connection)
|
||||||
{
|
{
|
||||||
while (!connection->doneProcessing) {
|
while (connection && !connection->doneProcessing) {
|
||||||
if (connection->doneListOk) {
|
if (connection->doneListOk) {
|
||||||
connection->doneListOk = 0;
|
connection->doneListOk = 0;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ namespace {
|
|||||||
mpd_info.status = "MPD not responding";
|
mpd_info.status = "MPD not responding";
|
||||||
}
|
}
|
||||||
mpd_finishCommand(conn);
|
mpd_finishCommand(conn);
|
||||||
if (conn->error) {
|
if (!conn || conn->error) {
|
||||||
// fprintf(stderr, "%s\n", conn->errorStr);
|
// fprintf(stderr, "%s\n", conn->errorStr);
|
||||||
mpd_closeConnection(conn);
|
mpd_closeConnection(conn);
|
||||||
conn = 0;
|
conn = 0;
|
||||||
@ -277,7 +277,7 @@ if (b) a=b; else a="";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mpd_finishCommand(conn);
|
mpd_finishCommand(conn);
|
||||||
if (conn->error) {
|
if (conn && conn->error) {
|
||||||
// fprintf(stderr, "%s\n", conn->errorStr);
|
// fprintf(stderr, "%s\n", conn->errorStr);
|
||||||
mpd_closeConnection(conn);
|
mpd_closeConnection(conn);
|
||||||
conn = 0;
|
conn = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user