0
votes

I am on an Ubuntu 19.10 64 bit system

Source files:

https://drive.google.com/open?id=1I4ejOHNXqbAOkTbIyJR0lvldsAwiPPqI

Problem:

I am working on a simple drawing program using gtk and glade with c. Right now I am stuck into implementing undoing behavior. I have two problems. There are cases for when I press the undo button.

1) When I have one stroke or one dot on the canvas, it works perfect as I experienced. Canvas clears itself.

2) When I have two strokes or two dots on the canvas, if I click undo once, canvas does not redraw itself, unless I draw again; if I click twice, it works perfect like in the first case, canvas clears.

3) When I have more than two strokes or two dots on the canvas, if I click undo twice, the program stops working waiting me to force quit.

I am a beginner at using glade, gtk3, and cairo libraries. I have been searching about the issue for days. However, the resources are scarce compared to trending frameworks and libraries. Furthermore, I couldn't match the problem I need. I appreciate any help.

EDIT I forgot to add that the halting problem occurs after the function , on_undo_clicked exits the second time (twice undo click).

1

1 Answers

0
votes

I solved the problem.

In the function, addPoint I forgot that the next struct pointer's pre pointer may be a dangling pointer. It creates the problem.