From: <bre...@us...> - 2007-08-31 23:45:45
|
Revision: 944 http://conky.svn.sourceforge.net/conky/?rev=944&view=rev Author: brenden1 Date: 2007-08-31 16:45:41 -0700 (Fri, 31 Aug 2007) Log Message: ----------- fix clearing issue with mpd Modified Paths: -------------- trunk/conky1/src/common.c trunk/conky1/src/conky.h trunk/conky1/src/mpd.c Modified: trunk/conky1/src/common.c =================================================================== --- trunk/conky1/src/common.c 2007-08-31 21:35:30 UTC (rev 943) +++ trunk/conky1/src/common.c 2007-08-31 23:45:41 UTC (rev 944) @@ -233,7 +233,7 @@ #ifdef MPD if (NEED(INFO_MPD)) { if (!mpd_timed_thread) { - clear_mpd_stats(&info); + init_mpd_stats(&info); mpd_timed_thread = timed_thread_create((void*)update_mpd, (void*) NULL, update_interval * 1000000); if (!mpd_timed_thread) { ERR("Failed to create MPD timed thread"); Modified: trunk/conky1/src/conky.h =================================================================== --- trunk/conky1/src/conky.h 2007-08-31 21:35:30 UTC (rev 943) +++ trunk/conky1/src/conky.h 2007-08-31 23:45:41 UTC (rev 944) @@ -619,7 +619,7 @@ /* in mpd.c */ #ifdef MPD -extern void clear_mpd_stats(struct information *current_info); +extern void init_mpd_stats(struct information *current_info); void *update_mpd(void); extern timed_thread *mpd_timed_thread; #endif /* MPD */ Modified: trunk/conky1/src/mpd.c =================================================================== --- trunk/conky1/src/mpd.c 2007-08-31 21:35:30 UTC (rev 943) +++ trunk/conky1/src/mpd.c 2007-08-31 23:45:41 UTC (rev 944) @@ -32,8 +32,9 @@ #include "libmpdclient.h" timed_thread *mpd_timed_thread = NULL; +void clear_mpd_stats(struct information *current_info); -void clear_mpd_stats(struct information *current_info) +void init_mpd_stats(struct information *current_info) { if (current_info->mpd.artist == NULL) current_info->mpd.artist = malloc(TEXT_BUFFER_SIZE); @@ -53,7 +54,11 @@ current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); if (current_info->mpd.file == NULL) current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); + clear_mpd_stats(current_info); +} +void clear_mpd_stats(struct information *current_info) +{ *current_info->mpd.name=0; *current_info->mpd.file=0; *current_info->mpd.artist=0; @@ -81,6 +86,9 @@ current_info->mpd.password); mpd_finishCommand(current_info->conn); } + + timed_thread_lock(mpd_timed_thread); + clear_mpd_stats(current_info); if (current_info->conn->error || current_info->conn == NULL) { //ERR("%MPD error: s\n", current_info->conn->errorStr); @@ -92,7 +100,6 @@ continue; } - timed_thread_lock(mpd_timed_thread); mpd_Status *status; mpd_InfoEntity *entity; mpd_sendStatusCommand(current_info->conn); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |