[gtk-server] Re: GtkTextIter

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Mon, 20 Nov 2006 12:10:44 +0100

Indeed I have used this construction in several situations successfully, also
other people did. At my newLisp page you can find some examples (the IDE, the
UDP chat and the e-text reader).

I am not sure what happens with the 'copy' action though.

In fact, it is always troublesome for interpreted languages to reach memory
which is addressed by C-pointers. In the current situation the best you can do
is using another widget to claim memory.

Citeren Ian Haywood <ihaywood@xxxxxxxxxxxx>:

> On Monday 20 November 2006 02:46, Peter van Eerten wrote:
> > Hi Ian,
> >
> > For the GtkIter widget you need to workaround your problem with a trick.
> > Indeed, there is no such function as a 'gtk_iter_new'. Therefore, you must
> > allocate memory with some other widget. I always use 'gtk_frame_new' for
> > this.
> Thanks for this.
>
> > Now your variable 'iter' points to allocated memory for a frame, where GTK
> > can store information for an iter-structure as well.
> Overwriting the frame data?
> I'd be worried this would cause memory leaks or similar weird issues when GTK
> tries to clean up the frame structure that's been scribbled over by the
> text_iter structure. Also we are praying that never
> sizeof(GtkTextIter) > sizeof (GtkFrame)
> However you imply that have used this technique in practice without problems,
> is that right?
>
> I suppose you could immediately pass the frame object to gtk_text_iter_copy
> ()
> which would give you a "real" text_iter memory allocation to use.
>
> Ian
>


-- 
http://www.gtk-server.org

Other related posts: