[Mono-list] Liststore not appending correctly

Luciano _ lnc19 at hotmail.com
Wed Mar 21 18:41:12 EDT 2007


Read this:
http://www.mono-project.com/ThreadsBeginnersGuide

Maybe something like this:
			object delegate_done = new object();
			Gtk.Application.Invoke( delegate {
                                                           // Your 
Operations
			lock(delegate_done) Monitor.Pulse(delegate_done);
			});
			lock(delegate_done) Monitor.Wait(delegate_done);

Hope it helps
Luciano


>From: Nil Gradisnik <ghaefbgtk at gmail.com>
>To: Luciano _ <lnc19 at hotmail.com>
>CC: mono-list at lists.ximian.com
>Subject: RE: [Mono-list] Liststore not appending correctly
>Date: Wed, 21 Mar 2007 22:51:11 +0100
>MIME-Version: 1.0
>Received: from nf-out-0910.google.com ([64.233.182.189]) by 
>bay0-mc9-f12.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Wed, 
>21 Mar 2007 14:49:19 -0700
>Received: by nf-out-0910.google.com with SMTP id a4so1138233nfc        for 
><lnc19 at hotmail.com>; Wed, 21 Mar 2007 14:49:19 -0700 (PDT)
>Received: by 10.82.107.15 with SMTP id f15mr2584233buc.1174513758843;       
>  Wed, 21 Mar 2007 14:49:18 -0700 (PDT)
>Received: from ?192.168.1.4? ( [195.210.246.130])        by mx.google.com 
>with ESMTP id y23sm6799606nfb.2007.03.21.14.49.17;        Wed, 21 Mar 2007 
>14:49:18 -0700 (PDT)
>X-Message-Info: 
>5ZHoJh3ZkQ2beHhjtR/Lqw+jGgHyYqvlcOX901YQIttX/7kYcd+iVW3Tpx/DmeMS
>DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed;        d=gmail.com; s=beta;  
>       
>h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; 
>        
>b=G4x4rJt/Zef3obVm2a6PDH29fwzFdsL6cXc782r/MakFg5igmIpZGfriVWGMLRNd/1EPGbt3DWeRDwpJCuGImAT5hgPlKzY3micSrP1JswZvvSDs/suIQrYdlSZd86jIWZMaIDXafkk7jlklX5E5ce4KYYtNgVLrzT76dPCv2ro=
>DomainKey-Signature: a=rsa-sha1; c=nofws;        d=gmail.com; s=beta;       
>  
>h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; 
>        
>b=SrM1dv7OK2DjbbV3Bmynn2ZU7rNOkHMx6qr1KAJfouD/88GyRCeWq8IyFVQ8R6tjF0UOkguQCQcAJsaEQGePN4BT0Xii5BKRQduqA7o+QfnQ44gnm7p/G5AkFNoYSO2AsQz2qLz+zlIN0ympXHp8pk3gwZIIizBDeIz5VouVU/E=
>Return-Path: <ghaefbgtk at gmail.com>
>References: <BAY142-F346553F627BAFA43B7F0B1A6740 at phx.gbl>
>X-Mailer: Evolution 2.8.3 (2.8.3-1.fc6) X-OriginalArrivalTime: 21 Mar 2007 
>21:49:19.0600 (UTC) FILETIME=[C77DE700:01C76C02]
>
>I see, thank you I'll try to ask on gtk-sharp list.
>
>But can you give me more details on how you fixed this issue by using
>Lock ?
>What is that and how should I use it.
>
>
>Thanks
>
>Nil Gradisnik
>
>
>On Wed, 2007-03-21 at 21:36 +0000, Luciano _ wrote:
> > maybe Gtk-sharp list is better place to ask this, but, (i'm not really 
>sure
> > about this)
> > the problem i guess is that Gtk.Application.Invokes, execute in main 
>thread,
> > when it can be executed, but not sequentially. Maybe, the Gtk Thread is
> > making some Re-paint or something else, and does not work like you want. 
>I'm
> > not really sure, i was having this problem (that i descript) and i fix 
>it by
> > using Lock (threads).
> >
> > Bye
> > Luciano
> >
> >
> > >From: Nil Gradisnik <ghaefbgtk at gmail.com>
> > >To: mono-list at lists.ximian.com
> > >Subject: [Mono-list] Liststore not appending correctly
> > >Date: Wed, 21 Mar 2007 19:25:31 +0100
> > >MIME-Version: 1.0
> > >Received: from lists.ximian.com ([130.57.169.22]) by
> > >bay0-mc4-f14.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); 
>Wed,
> > >21 Mar 2007 11:24:03 -0700
> > >Received: from galactus.ximian.com (localhost.localdomain 
>[127.0.0.1])by
> > >lists.ximian.com (Postfix) with ESMTP id A39861CFBDB;Wed, 21 Mar 2007
> > >16:05:54 -0400 (EDT)
> > >Received: from herald.ximian.com (frontgate.ximian.com 
>[130.57.169.19])by
> > >lists.ximian.com (Postfix) with ESMTP id 16D681CFBD5for
> > ><mono-list at lists.ximian.com>; Wed, 21 Mar 2007 16:05:53 -0400 (EDT)
> > >Received: by herald.ximian.com (Postfix, from userid 2601)id 
>4B40F700C2;
> > >Wed, 21 Mar 2007 13:23:52 -0500 (EST)
> > >Received: from mu-out-0910.google.com (mu-out-0910.google.com
> > >[209.85.134.186])by herald.ximian.com (Postfix) with ESMTP id 
>E7F7A700C2for
> > ><mono-list at lists.ximian.com>; Wed, 21 Mar 2007 13:23:48 -0500 (EST)
> > >Received: by mu-out-0910.google.com with SMTP id i2so589794muefor
> > ><mono-list at lists.ximian.com>; Wed, 21 Mar 2007 11:23:47 -0700 (PDT)
> > >Received: by 10.82.146.14 with SMTP id 
>t14mr2212125bud.1174501423296;Wed,
> > >21 Mar 2007 11:23:43 -0700 (PDT)
> > >Received: from ?192.168.1.4? ( [195.210.246.130])by mx.google.com with
> > >ESMTP id w5sm7994538mue.2007.03.21.11.23.42;Wed, 21 Mar 2007 11:23:42 
>-0700
> > >(PDT)
> > >X-Message-Info:
> > >txF49lGdW41PiY++DHdEakZftiq+hFZVIZ/MSj+RNwy4Y1T3HH+ONmwdZpr5qsUj
> > >X-Original-To: mono-list at lists.ximian.com
> > >Delivered-To: mono-list at lists.ximian.com
> > >X-Mailer: Evolution 2.8.3 (2.8.3-1.fc6) X-Spam-Checker-Version:
> > >SpamAssassin 3.0.3 (2005-04-27) on frontgate.ximian.com
> > >X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0
> > >tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS version=3.0.3
> > >X-BeenThere: mono-list at lists.ximian.com
> > >X-Mailman-Version: 2.1.8
> > >Precedence: list
> > >List-Id: Mono Developer Discussion List <mono-list.lists.ximian.com>
> > >List-Unsubscribe:
> > 
> ><http://lists.ximian.com/mailman/listinfo/mono-list>,<mailto:mono-list-request at lists.ximian.com?subject=unsubscribe>
> > >List-Archive: <http://lists.ximian.com/pipermail/mono-list>
> > >List-Post: <mailto:mono-list at lists.ximian.com>
> > >List-Help: <mailto:mono-list-request at lists.ximian.com?subject=help>
> > >List-Subscribe:
> > 
> ><http://lists.ximian.com/mailman/listinfo/mono-list>,<mailto:mono-list-request at lists.ximian.com?subject=subscribe>
> > >Errors-To: mono-list-bounces at lists.ximian.com
> > >Return-Path: mono-list-bounces at lists.ximian.com
> > >X-OriginalArrivalTime: 21 Mar 2007 18:24:04.0020 (UTC)
> > >FILETIME=[1AD58740:01C76BE6]
> > >
> > >I need your opinion on this one. I'm running a Thread which starts this
> > >function named PopulateTreevew() and in there this is what happens:
> > >
> > >//populate treeview
> > >public void PopulateTreeviewThreadRoutine()
> > >{
> > >	Gtk.Application.Invoke (delegate {
> > >		liststore.Clear();
> > >	});
> > >
> > >	for (int i = 0; i < 10; i++) {
> > >
> > >		Console.WriteLine (i); //THIS one works
> > >		Gtk.Application.Invoke (delegate {
> > >			Console.WriteLine (i); //THIS one sometimes works
> > >			liststore.AppendValues (i);
> > >		});
> > >	}
> > >
> > >	Gtk.Application.Invoke (delegate {
> > >		Treeview1.Model = liststore;
> > >	});
> > >}
> > >
> > >My main problem is that I sometimes get all the same(the last) contents
> > >of my variable array to my Treeview, using liststore.AppendValues... I
> > >tested this values with Console.WriteLine.
> > >As you can see I'm using Gtk.Application.Invoke, because I'm running a
> > >Thread outside the main GTK thread.
> > >
> > >So basically I narrowed it down to this, that if I print out those
> > >variables(arrays) before the Gtk.Application.Invoke, it always prints
> > >out OK, the numbers(i) are 0,1,2,3,4,5,6...9. But If I print them out
> > >inside Gtk.Application.Invoke I sometimes(randomly) get just all 9s !
> > >That is 9,9,9,9,9.......9.
> > >
> > >Why is that ? What could cause this problem, I don't understand.
> > >It looks like a bug in Gtk.Application.Invoke or something.
> > >
> > >Can I use something else than Gtk.Application.Invoke, so that I get out
> > >the correct array?
> > >Because it looks like the Gtk.Application.Invoke messes up things
> > >randomly.
> > >
> > >
> > >Please advise
> > >
> > >Thanks
> > >
> > >
> > >Nil Gradisnik
> > >
> > >_______________________________________________
> > >Mono-list maillist  -  Mono-list at lists.ximian.com
> > >http://lists.ximian.com/mailman/listinfo/mono-list
> >
> > _________________________________________________________________
> > Consigue aquí las mejores y mas recientes ofertas de trabajo EE.UU.
> > http://latino.msn.com/empleos
> >
>

_________________________________________________________________
Visita MSN Latino Noticias: Todo lo que pasa en el mundo y en tu paín, ¡en 
tu idioma! http://latino.msn.com/noticias/



More information about the Mono-list mailing list