1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 09:44:04 +00:00

jack object counting... + temporary debug output

This commit is contained in:
James Morris 2013-01-31 00:52:29 +00:00
parent 3068dfabd7
commit 0195329833

View File

@ -40,7 +40,7 @@ static int* zombified = 0;
#endif #endif
static jack_client_t* client = 0; static jack_client_t* client = 0;
static int init_done = 0; /* work around repated calls to init_jack in various circumstances */ static int obj_count = 0;
static void jack_shutdown_cb(void* arg) static void jack_shutdown_cb(void* arg)
{ {
@ -107,11 +107,14 @@ void init_jack(void)
struct information *current_info = &info; struct information *current_info = &info;
struct jack_s* jackdata = &current_info->jack; struct jack_s* jackdata = &current_info->jack;
/* work around repated calls to init_jack in various circumstances */ printf("init_jack...\n");
if (!init_done) {
init_done = 1; if (!obj_count++) {
printf("zeroing jackdata->state\n");
jackdata->state = 0; jackdata->state = 0;
} }
printf("%d jack objects now exist\n", obj_count);
} }
int update_jack(void) int update_jack(void)
@ -144,7 +147,7 @@ int update_jack(void)
} }
if (!client) if (!client)
return; return 0;
if (jackdata->state & JACK_IS_ACTIVE) { if (jackdata->state & JACK_IS_ACTIVE) {
jack_position_t pos; jack_position_t pos;
@ -190,6 +193,7 @@ int update_jack(void)
#else #else
if (zombified == zzz) { if (zombified == zzz) {
#endif #endif
printf("zombified...\n");
jackdata->state = 0; jackdata->state = 0;
client = 0; client = 0;
} }
@ -199,12 +203,21 @@ int update_jack(void)
void jack_close(void) void jack_close(void)
{ {
printf("jack_close...\n");
if (obj_count)
--obj_count;
if (client) { if (client) {
printf("%d jack objects remain\n", obj_count);
if (!obj_count) {
struct information *current_info = &info; struct information *current_info = &info;
struct jack_s* jackdata = &current_info->jack; struct jack_s* jackdata = &current_info->jack;
printf("calling jack_client_close\n");
jack_client_close(client); jack_client_close(client);
client = 0; client = 0;
jackdata->state = 0; jackdata->state = 0;
} }
} }
}