[Evolution-hackers] Camel calls causing hangs?



Hey all,


My plugin is hanging and I dont know why. I created a new thread using
a GThread and g_thread_create.
In the new thread I have all my camel calls. (I assume this is what
you guys mean when you say dont
have camel calls in the main thread).

Are the camel calls allowed to be called like below? I managed to get
a GPtrArray of folders but I
think it hangs after that when I try to get the messages.

I realise I shouldnt be trying to get all the messages but I'm trying
it on a small mailbox just to
get some working code and then I'll optimize it later (if I get there).

Well this is where I think it's hanging:

gpointer pimp_mail_process_mail(gpointer data)
{
	GPtrArray* stores = (GPtrArray*) data;
	GPtrArray* folders = g_ptr_array_new();
	GPtrArray* messages = g_ptr_array_new();
	int i, j;	
	
	for(i = 0; i < stores->len; i++)
	{
		CamelStore* store = (CamelStore*) g_ptr_array_index(stores, i);
		CamelFolderInfo* info = camel_store_get_folder_info(store , NULL,
								CAMEL_STORE_FOLDER_INFO_SUBSCRIBED | CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL,
								NULL);
		
		if(info != NULL)
		{
			//get top of directory
			while(info->parent != NULL)
				info = info->parent;
			
			//gets list of folders - works till here
			pimp_mail_process_folderinfo(store, info, &folders);
		}
	}
	

        //it hangs in this loop - WHY????
	for(i = 0; i < folders->len; i++)
	{
		CamelFolder* folder = (CamelFolder*) g_ptr_array_index(folders, i);
		GPtrArray* uids = camel_folder_get_uids(folder);

		for(j = 0; j < uids->len; i++)
		{
			CamelMimeMessage* message = camel_folder_get_message(folder, (const
char*) g_ptr_array_index(uids, j), NULL);
			
			if(message != NULL)
				g_ptr_array_add(messages, message);
		}
	}
	
	//do stuff with messages here
	
	g_ptr_array_free(messages);
	g_ptr_array_free(folders);
	g_ptr_array_free(stores);
	
	return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]