bug-ncurses
[Top][All Lists]
Advanced

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

SOLVED: Infinite loop in frm_driver.c


From: Marlin Forbes
Subject: SOLVED: Infinite loop in frm_driver.c
Date: Thu, 30 Aug 2001 11:37:46 +0200

Hi,

I've tracked down my problem and would like to post a warning to others for 
future reference, or (even better) a request to rewrite a particular section 
of code in the frm_driver.c file.

I keep collections of fields in memory so that I can move them around 
dynamically depending on previous form content, etc. Part of storing them 
involved doing a memcpy of the field to a dynamic array, which resulted in a 
different memory address for the structure.

At field creation time, the field->link attribute is set to the address of 
the field structure. In the Synchronize_Linked_Fields function , it checks to 
see if the field->link attrib is equal to the address of the field, and then 
exits from a for loop if so.

However, I have moved the location of the field in memory using memcpy, so 
the address of the field in memory is not equal to field->link. field->link 
IS NOT equal to field and field->link IS equal to the field at 
field->link->link because the old copy still exists 
in memory. So the loop keeps on going around and around and around...

Is this a serious issue? Am I being stupid in copying structures in memory?
I have figured out the solution to my problem, but surely this could happen 
to anyone using a similar approach.

Regards,
M.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]