Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Trusted Contributor
bbdev12345
Posts: 117
Registered: ‎09-06-2011
My Device: 9900

img_load problem

Hi,

 

I am having trouble sometimes when loading images of diferent resolutions sent via socket. Most of the images I have tested load fine but so far one image i have tried to load just hangs at img_load.

 

Can anyboady give me a suggestions as to why it would hang and what i can do about?

 

Thanks in advance.

 

img_lib_t ilib = NULL;
		int rc;
		rc = img_lib_attach(&ilib);
		img.flags = 0;
		screen_create_window_buffers(screen_win, 1);
		img.flags |= IMG_DIRECT;
		img.format = IMG_FMT_PKLE_ARGB8888;
		img.flags |= IMG_FORMAT;
		img.w = readX;
		img.flags |= IMG_W;

		img.h = readY;
		img.flags |= IMG_H;
		if(totalBytes == image_size)
		{
			fprintf(stdout, "\n before io_open");

			io_stream_t* memory_stream = io_open(IO_MEM, IO_READ, totalBytes, complete_data);
			fprintf(stdout, "\n after io open");

			if (( rc = img_load(ilib, memory_stream, NULL, &img)) != IMG_ERR_OK) {
				fprintf(stdout, "img_load_file() failed: %d\n",  rc);
				//return;
			} else {
				fprintf(stdout, "\n img_load_file() didnt fail: %d\n",  rc);
			}
			fflush(stdout);

 

Trusted Contributor
bbdev12345
Posts: 117
Registered: ‎09-06-2011
My Device: 9900

Re: img_load problem

I have just found this in the gdb traces log when it hangs but memcpy isn't being executed when it hangs - img_load is.

 

076,593 *running,thread-id="all"
076,593 ~"[Switching to pid 23523484 tid 3]\n"
076,625 *stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",\
frame={addr="0x01302f40",func="memcpyv",args=[],from="C:/bbndk-2.1.0-beta1/target/qnx6/armle-v7/usr/\
lib/ldqnx.so.2"},thread-id="3",stopped-threads="all"
076,625 =thread-selected,id="3"
076,625 (gdb)

 

Any help appreciated.

Trusted Contributor
bbdev12345
Posts: 117
Registered: ‎09-06-2011
My Device: 9900

Re: img_load problem

I have been working on this now for more than 24 hours and still not getting anywhere near to solving it on my own.

 

All images except one which I have tried to display using my code (see first post) has loaded and displayed fine. The image which doesn't load has a res of 480 x 800. 

 

Trying to load image from bytes using img_load will give me segmentation fault (see above post) when setting img.w and img.h to 480 and 800.

 

However, what i have learnt is when i set img.h and img.w both to 480 (width of image) before img_load it won't cause a segmentation fault. 

 

Can anybody please explain why this strange behaviour would happen and what I am meant to be doing differently.

 

thanks.

Trusted Contributor
bbdev12345
Posts: 117
Registered: ‎09-06-2011
My Device: 9900

Re: img_load problem

I have had to give up on this as the time spent has gotten ridiculous.

 

unless you get support here for ndk you are stumped as platform is new - and supports seems very limited for it here.

 

Thanks.