diff options
author | Nalin Dahyabhai <nalin@src.gnome.org> | 2002-09-03 22:35:37 +0000 |
---|---|---|
committer | Nalin Dahyabhai <nalin@src.gnome.org> | 2002-09-03 22:35:37 +0000 |
commit | f0953feec5ff4b6cb5e0a93f4049cac1cb78098d (patch) | |
tree | b69f005046e8d731af08f4857f632828abc92f16 | |
parent | 27721b50e75f6d75fabf685270ad519a91bbabf7 (diff) |
Avoid double color deallocations with Xft.vte_0_8_17
* src/vte.c: Avoid double color deallocations with Xft.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/vte.c | 34 | ||||
-rw-r--r-- | vte.spec | 5 |
3 files changed, 29 insertions, 13 deletions
@@ -1,4 +1,7 @@ 2002-09-03 nalin + * src/vte.c: Avoid double color deallocations with Xft. + +2002-09-03 nalin * src/vte.c: Handle color allocation failures with Xft better. * src/vte.h: Clean up typedef declarations. @@ -319,6 +319,7 @@ struct _VteTerminalPrivate { #ifdef HAVE_XFT XRenderColor rcolor; XftColor ftcolor; + gboolean ftcolor_allocated; #endif } palette[VTE_BOLD_FG + 1]; @@ -5314,9 +5315,12 @@ vte_terminal_set_color_internal(VteTerminal *terminal, int entry, /* Try to allocate a color with Xft, otherwise fudge it. */ if (XftColorAllocValue(display, visual, colormap, - rcolor, ftcolor) == 0) { + rcolor, ftcolor) != 0) { + terminal->pvt->palette[entry].ftcolor_allocated = TRUE; + } else { ftcolor->color = *rcolor; ftcolor->pixel = color.pixel; + terminal->pvt->palette[entry].ftcolor_allocated = FALSE; } } #endif @@ -10129,17 +10133,23 @@ vte_terminal_unrealize(GtkWidget *widget) terminal->pvt->im_preedit_cursor = 0; #ifdef HAVE_XFT - /* Clean up after Xft. */ - display = gdk_x11_drawable_get_xdisplay(widget->window); - gvisual = gtk_widget_get_visual(widget); - visual = gdk_x11_visual_get_xvisual(gvisual); - gcolormap = gtk_widget_get_colormap(widget); - colormap = gdk_x11_colormap_get_xcolormap(gcolormap); - for (i = 0; i < G_N_ELEMENTS(terminal->pvt->palette); i++) { - XftColorFree(display, - visual, - colormap, - &terminal->pvt->palette[i].ftcolor); + if ((terminal->pvt->render_method == VteRenderXft1) || + (terminal->pvt->render_method == VteRenderXft2)) { + /* Clean up after Xft. */ + display = gdk_x11_drawable_get_xdisplay(widget->window); + gvisual = gtk_widget_get_visual(widget); + visual = gdk_x11_visual_get_xvisual(gvisual); + gcolormap = gtk_widget_get_colormap(widget); + colormap = gdk_x11_colormap_get_xcolormap(gcolormap); + for (i = 0; i < G_N_ELEMENTS(terminal->pvt->palette); i++) { + if (terminal->pvt->palette[i].ftcolor_allocated) { + XftColorFree(display, + visual, + colormap, + &terminal->pvt->palette[i].ftcolor); + terminal->pvt->palette[i].ftcolor_allocated = FALSE; + } + } } #endif @@ -1,5 +1,5 @@ Name: vte -Version: 0.8.16 +Version: 0.8.17 Release: 1 Summary: An experimental terminal emulator. License: LGPL @@ -61,6 +61,9 @@ rm $RPM_BUILD_ROOT/%{_libdir}/lib%{name}.la %{_libdir}/pkgconfig/* %changelog +* Tue Sep 3 2002 Nalin Dahyabhai <nalin@redhat.com> 0.8.17-1 +- track Xft color deallocation to prevent freeing of colors we don't own + * Tue Sep 3 2002 Nalin Dahyabhai <nalin@redhat.com> 0.8.16-1 - handle color allocation failures better |