altf4 / RealTimeTactics

Real Time Tactics (RTT) Game
GNU General Public License v3.0
6 stars 4 forks source link

Crash when selecting new leader #29

Closed altf4 closed 12 years ago

altf4 commented 12 years ago

To reproduce:

1) Set up a server and one client. Connect the client and go into a match. 2) Press the leader check mark on the client around 12-20 times.

Should crash now.

Complains about:

* glibc detected * ./Debug/RTT_Client_GTK: double free or corruption (fasttop): 0x09de7240 ***

You can stop the crash by commenting out the lines

row[playerColumns.isLeader] = true; row[playerColumns.isLeader] = false; (4 of them)

inside case LEADER_CHANGE: of the void CallbackThread(void \ parm) function of RTT_Client_GTK

altf4 commented 12 years ago

Almost surely related is the fact that you can also make the GTK client crash by having two clients in a match, and have them in turn leave the match, then rejoin. Do that a few times, and it will crash with the same sort of issues.

Except that when doing this, the code for changing leader doesn't get hit. (IE: The checkbox event handler and the leader_changed callback case) There is something very screwy going on with how I'm using gtkmm. I don't know what I'm doing wrong...

altf4 commented 12 years ago

Fixed in ef0c701f3412ea769

Turns out I was doing threads all wrong with Gtk. You can't just go and edit a GUI's attributes in a non-GUI thread willy-nilly. Even with manual locking. You have to make signal dispatchers into the GUI thread to ask IT to make the changes for you. Lesson learned.