To Eric Cashon or other,
I am still in the process of rebuilding my app based on the example you sent me “You are on the right track there” in response to “Passing values from spinbutton callbacks to a calculation drawing function”. I have been implementing dynamic memory allocation with malloc(), due to the many large arrays required. I am passing the values using a struct containing drawing-area widgets, single-valued integers and doubles, and one and two-dimensional C arrays. I have it working with three notebook pages each with their own drawing area function (contained in separate .c files compiled together). Each of the drawing areas are about 4000 x 800 and each also has similarly sized dynamically allocated arrays. The drawing areas are declared in the struct and defined as NULL in main() as in your example and I until now have simply added more drawing areas into the struct following that example. I have then added a fourth notebook page and a drawing/calculation function which compiles and runs (showing a blank notebook page as expected). However, upon trying to implement a fourth drawing area a segmentation fault results, even by simply declaring it in the struct, with or without the NULL pointer being defined in main(), (which until now had worked for the other drawing areas).
The program runs with the struct containing:
3 drawing areas (3800x800 pixels),
30 single-valued integers,
60 single-valued doubles,
9 one-dimensional double arrays (each 4096 in length),
3 two-dimensional double arrays (40x5),
4 two-dimensional double arrays (4096x1024),
but won’t run without segmentation during the initial drawing of the window when compiled with just one more drawing area added.
Do I need to dynamically allocate memory for the drawing areas as well, if so how do I do this, or is it something to do with the size of the structure? I’ve checked the code numerous times for mistakes and omissions to no avail, help….
Thanks,
Roger.
C language, Ubuntu 18.04.1 LTS, Gtk 3.2 and 8GB RAM, 64 bit