texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Texmacs-dev] Re: [E-devel] Segfault with Imlib2


From: Joris van der Hoeven
Subject: [Texmacs-dev] Re: [E-devel] Segfault with Imlib2
Date: Thu, 7 Jul 2005 12:05:07 +0200
User-agent: Mutt/1.5.9i

On Thu, Jul 07, 2005 at 01:08:40PM +0900, Carsten Haitzler wrote:
> On Mon, 4 Jul 2005 11:39:09 +0200 Joris van der Hoeven <address@hidden>
> > Still continuing with using Imlib2 inside TeXmacs under all kinds
> > of circumstances... When linking dynamically, everything went fine,
> > but my static binaries have an annoying problem. Here is a backtrace:
> 
> thats really weird.

But very unfortunate, since it makes it impossible for me to
distribute Imlib2 with my static binaries and RPM's,
in which case I would have to remove the Imlib2 support :^(((

> mind u imlib2 NEEDS to dynamically load loaders to load
> anything - so u cant make a fully static binary that can load images without
> also installing loader.so's - kind of pointless to make it static then.

Aha; so linking with libImlib2.a is not enough?
In that case, I still should be able to opt for static binaries,
which dynamically link with Imlib2 at runtime. But this also does not work.

> hmm it might be also that when u compile statically the symbols that are IN 
> imlib2
> become inaccessible to the loader - as it needs to resolve symbols back in the
> lib.

I don't know; sometimes the order of linking options also causes
strange problems, in which case the problem might be on my side.
In any case, I use the same mechanism for Imlib2 as for Freetype.
So I do suspect a problem at the Imlib2 side.

For your knowledge, this is the file with the current Imlib2 interface:

http://www.texmacs.org/cgi-bin/cvsweb.cgi/src/src/Plugins/Imlib2/imlib2.cpp?rev=1.5&content-type=text/x-cvsweb-markup

If you have some time to lose, you may even try compiling the last
CVS version of TeXmacs. You just need the X11 and Guile developers
libraries for that. You have two options for configuring TeXmacs:

        ./configure --with-imlib2=yes
        ./configure --with-imlib2=linked

The first will attempt to link Imlib2 at runtime. The second one
will attempt to link it at link time. You next have two options
for building TeXmacs:

        make
        make STATIC_TEXMACS

The first one builds a dynamic TeXmacs and the second one a static binary.

Best wishes and thank your help, Joris

> > #0  0x083c39ed in chunk_free (ar_ptr=0x84f0f68, p=0x8be3000) at 
> > malloc.c:3231
> > #1  0x083c6311 in __libc_free (mem=0x8becfd8) at malloc.c:3154
> > #2  0x0835c233 in __imlib_ConsumeImage (im=0x8bc68c0) at image.c:176
> > #3  0x0835c505 in __imlib_CleanupImageCache () at image.c:381
> > #4  0x0835d28a in __imlib_FreeImage (im=0x8bc68c0) at image.c:1172
> > #5  0x0834824a in imlib_free_image () at api.c:1327
> > #6  0x08190818 in imlib2_image_size (u={rep = 0x8a58458}, address@hidden,
> > address@hidden) at ./Plugins/Imlib2/imlib2.cpp:123 #7  0x081901a8 in 
> > image_size
> > (image={rep = 0x8a58458}, address@hidden, address@hidden) at
> > ./System/Files/image_files.cpp:145 #8  0x0813d509 in
> > image_widget_rep::handle_repaint (this=0x8798678, ev=
> >         {<event_ptr_base> = {rep = 0x8858688}, <No data fields>}) at
> >         ./Window/Widget/Misc/file_chooser_widget.cpp:323
> > ...
> > 
> > The routine imlib2_image_size is mine. Here it is:
> > 
> > -----------------------------------------------------
> > void
> > imlib2_image_size (url u, int& w, int& h) {
> >   if (imlib2_size_cache->contains (u->t)) {
> >     w= as_int (imlib2_size_cache[u->t][0]);
> >     h= as_int (imlib2_size_cache[u->t][1]);
> >   }
> >   else {
> >     Imlib_Image image= imlib2_load_image (u);
> >     if (image) {
> >       IMLIB2_context_set_image (image);
> >       w= IMLIB2_image_get_width ();
> >       h= IMLIB2_image_get_height ();
> >       IMLIB2_free_image ();
> >       imlib2_size_cache (u->t)= tuple (as_string (w), as_string (h));
> >     }
> >   }
> > }
> > -----------------------------------------------------
> > 
> > The routines IMLIB2_x are just copies of the corresponding
> > routines imlib_x (so as to allow for dynamic linking).
> > For your knowledge, here is also the routine imlib2_load_image:
> > 
> > -----------------------------------------------------
> > static Imlib_Image
> > imlib2_load_image (url u) {
> >   url name= resolve (u);
> >   if (is_none (name))
> >     name= resolve ("$TEXMACS_PIXMAP_PATH/TeXmacs-gnu.xpm");
> >   char *_name= as_charp (as_string (name));
> >   Imlib_Image image;
> >   image = IMLIB2_load_image (_name);
> >   delete[] _name;
> >   return image;
> > }
> > -----------------------------------------------------
> > 
> > Am I doing something wrong with the memory management?
> > 
> > Thanks, Joris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]