Make the pipe closing work all of the time (so far), memory leak fixes.

This commit is contained in:
Jaime Thomas 2008-12-26 16:41:27 +00:00
parent 1620e5d3fb
commit 21d6c80f55
4 changed files with 23 additions and 9 deletions

View File

@ -158,6 +158,7 @@ SHUTDOWN:
edje_shutdown();
efreet_shutdown();
eina_shutdown();
ewl_shutdown();
printf("Program Done\n");
return ret;

View File

@ -159,7 +159,7 @@ ecdb_burn_project(Ecdb_Burn_Project *proj)
burn_write_opts_free(opts);
printf("Disc now burning\n");
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_burn_progress_handler, NULL);
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_burn_progress_handler, proj);
pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj);
pthread_detach(progress_update);
ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add
@ -201,9 +201,8 @@ ecdb_drive_progress_update(void *data)
usleep(100000);
}
ecore_pipe_write(proj->pipe, "AC", sizeof("AC"));
ecore_pipe_del(proj->pipe);
/* Call the finished event handler here */
printf("Closing pipe\n");
ecore_pipe_write(proj->pipe, proj->pipe, sizeof(Ecore_Pipe));
pthread_exit(NULL);
}
@ -214,12 +213,14 @@ ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
Evas_Object *swallow;
static int last_sector = 0;
int percent;
Edje_Message_Int_Set *progress_msg = NULL;
Edje_Message_Int_Set *progress_msg;
Edje_Message_String finalize;
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
printf("In progress handler, %d %d\n", sizeof(BurnProgress), nbyte);
if (nbyte != sizeof(BurnProgress))
{
ecore_event_add(ECDB_DRIVE_ACTION_FINISHED, NULL, NULL, NULL);
printf("Adding event to queue.\n");
last_sector = 0;
return;
}
@ -285,6 +286,7 @@ ecdb_burn_finished(void *data, int type, void *event)
printf("Burn Complete\n");
ecore_event_handler_del(proj->proj->ev_handler);
ecore_pipe_del(proj->proj->pipe);
switch (proj->proj->type)
{

View File

@ -78,7 +78,7 @@ ecdb_erase_disc(Ecdb_Erase_Project *proj)
{
printf("Beginning to erase disc!\n");
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_erase_progress_handler,
NULL);
proj);
burn_disc_erase(ECDB_PROJECT(proj)->drive->tangible[0].drive,
proj->quick);
pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj);
@ -102,9 +102,11 @@ ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
static int last_sector = 0;
Edje_Message_Int_Set *progress_msg;
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
printf("In progress handler, %d, %d\n", sizeof(BurnProgress), nbyte);
if (nbyte != sizeof(BurnProgress))
{
ecore_event_add(ECDB_DRIVE_ACTION_FINISHED, NULL, NULL, NULL);
printf("Adding event to queue.\n");
last_sector = 0;
return;
}
@ -151,6 +153,7 @@ ecdb_erase_finished(void *data, int type, void *event)
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0);
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
ecore_event_handler_del(ECDB_PROJECT(proj)->ev_handler);
ecore_pipe_del(ECDB_PROJECT(proj)->pipe);
ecdb_erase_project_destroy(proj);
ecdb_erase_cleanup();

View File

@ -167,8 +167,15 @@ struct _Check_Data
{
unsigned int checked;
};
static void
_check_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Check_Data *cd;
cd = evas_object_data_get(data, "cd");
FREE(cd);
}
void
static void
_check_toggle_cb_call(void *data, Evas_Object *obj, const char *emission,
const char *source)
{
@ -197,6 +204,7 @@ ecdb_check_add(Evas_Object *parent, const char *name)
edje_object_file_set(c, em->theme_path, "ecdb/check");
edje_object_signal_callback_add(c, "ecdb,check,*", "ecdb",
_check_toggle_cb_call, c);
evas_object_event_callback_add(c, EVAS_CALLBACK_DEL, _check_del, c);
cd = calloc(1, sizeof(Check_Data));
evas_object_data_set(c, "cd", cd);