pkgsrc-Bugs archive

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

pkg/45448: xfce4-terminal-0.4.2nb5 causes 100% usage of CPU in X server



>Number:         45448
>Category:       pkg
>Synopsis:       xfce4-terminal-0.4.2nb5 causes 100% usage of CPU in X server
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 09 23:45:00 +0000 2011
>Originator:     Jose Luis Rodriguez Garcia
>Release:        NetBSD 5.1
>Organization:
>Environment:
NetBSD pc2 5.1 NetBSD 5.1 (GENERIC) #1: Sun Jul 31 16:36:52 CEST 2011  
root@:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
When opening a xfce4-terminal, the cpu usage of X server goes up to 100%.

It seems the problem described in: 
https://bugzilla.xfce.org/show_bug.cgi?id=6921 Reading the description of the 
bug, it seems that
this problem has been trigered by an update of gtk2.

I have backported the patch described in the bugzilla of xfce website, to the 
version xfce4-terminal-0.4.2nb5 and it has resolved the problem
>How-To-Repeat:
Start a xfce4-terminal
>Fix:
$NetBSD$

--- terminal/terminal-screen.c.orig     2011-10-09 09:22:44.000000000 +0000
+++ terminal/terminal-screen.c
@@ -87,6 +87,7 @@ static gboolean   terminal_screen_get_ch
                                                                  GError        
       **error);
 static gchar    **terminal_screen_get_child_environment         
(TerminalScreen        *screen);
 static void       terminal_screen_update_background             
(TerminalScreen        *screen);
+static void       terminal_screen_update_background_fast        
(TerminalScreen        *screen);
 static void       terminal_screen_update_binding_backspace      
(TerminalScreen        *screen);
 static void       terminal_screen_update_binding_delete         
(TerminalScreen        *screen);
 static void       terminal_screen_update_colors                 
(TerminalScreen        *screen);
@@ -132,6 +133,8 @@ struct _TerminalScreen
   GtkWidget           *scrollbar;
   GtkWidget           *tab_label;
 
+  gulong               background_signal_id;
+
   GPid                 pid;
   gchar               *working_directory;
 
@@ -231,7 +234,6 @@ terminal_screen_init (TerminalScreen *sc
                     "signal::context-menu", G_CALLBACK 
(terminal_screen_vte_get_context_menu), screen,
                     "signal::selection-changed", G_CALLBACK 
(terminal_screen_vte_selection_changed), screen,
                     "signal::window-title-changed", G_CALLBACK 
(terminal_screen_vte_window_title_changed), screen,
-                    "swapped-signal::size-allocate", G_CALLBACK 
(terminal_screen_timer_background), screen,
                     "swapped-signal::style-set", G_CALLBACK 
(terminal_screen_update_colors), screen,
                     NULL);
   gtk_box_pack_start (GTK_BOX (screen), screen->terminal, TRUE, TRUE, 0);
@@ -573,6 +575,18 @@ terminal_screen_get_child_environment (T
 
 
 static void
+terminal_screen_update_background_fast (TerminalScreen *screen)
+{
+  if (G_UNLIKELY (screen->background_timer_id == 0))
+    {
+      screen->background_timer_id = g_idle_add_full (G_PRIORITY_LOW, 
terminal_screen_timer_background,
+                                                     screen, 
terminal_screen_timer_background_destroy);
+    }
+}
+
+
+
+static void
 terminal_screen_update_background (TerminalScreen *screen)
 {
   if (G_UNLIKELY (screen->background_timer_id != 0))
@@ -1015,9 +1029,25 @@ terminal_screen_timer_background (gpoint
       if (G_LIKELY (image != NULL))
         g_object_unref (G_OBJECT (image));
       g_object_unref (G_OBJECT (loader));
+      
+            /* refresh background on size changes */
+            if (screen->background_signal_id == 0)
+              {
+                screen->background_signal_id =
+                   g_signal_connect_swapped (G_OBJECT (screen->terminal), 
"size-allocate",
+                                             G_CALLBACK 
(terminal_screen_update_background_fast), screen);
+              }
     }
   else
     {
+          /* stop updating on size changes */
+          if (screen->background_signal_id != 0)
+            {
+              g_signal_handler_disconnect (G_OBJECT (screen->terminal), 
screen->background_signal_id);
+              screen->background_signal_id = 0;
+            }
+    
+          /* WARNING: the causes a resize too! */
       vte_terminal_set_background_image (VTE_TERMINAL (screen->terminal), 
NULL);
     }
 



Home | Main Index | Thread Index | Old Index