DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=tObVuT+ClyiniKyPoOklwUqyyrGi0SmrB5MwoI9UuNsumo6aC6NiyjTPPsg9TTVDwLYUTbrX5YtHtWpuLxh//aHqL7RDPFQquVQt/V7IWAcGi2BU2rba081dIZ5zroFFKOJRgxYWyy6bmzO7A+Vt5biXQiI8K+AU1VLSatmglK4= Message-ID: Date: Sun, 23 Oct 2005 23:00:42 +0100 From: Robert Schneck-McConnell To: lablgtk at math.nagoya-u.ac.jp Subject: Threading issues, and custom tree models MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit I've got a custom tree model up and running with LablGTK. The trick is to ensure the values stored in GtkTreeIters aren't in the minor heap. LablGTK already forbids heap compaction, I recently found out, so those values aren't moving. I still get occasional weird behavior which seems to be related to threading issues. I use basically Thread.create (GtkThread.main ()) to set GTK going. The real main thread of the program is messing with the data structure which the custom tree model accesses with OCaml callbacks. I observe the following happen: (1) The GTK thread is refreshing the display and calling the custom model's get_value function to get the values in the columns of row r. (2) Halfway through the columns, the main thread deletes (an ancestor of) r, emits the GTK signal row_deleted, and moves on. (3) The GTK thread continues getting the values of the columns of r, which no longer exists. It seems to me that I need to make all changes to the tree model's data structure wait for GTK. It almost looks like there are functions in GtkThread to do this, but I don't quite understand. Can anyone explain? Robert