xerror + resurce problem with gtk_label_set_markup
- From: Wojciech Kromer <wojciech kromer dgt com pl>
- To: gtk-app-devel-list gnome org
- Subject: xerror + resurce problem with gtk_label_set_markup
- Date: Tue, 16 May 2006 09:08:29 +0200
Why included program causes xerror?
How to debug it?
Here is log from gdb:
Breakpoint 1, 0x08048e02 in fcm_x_error ()
(gdb) bt
#0 0x08048e02 in fcm_x_error ()
#1 0xb775d604 in _XError (dpy=0x8057900, rep=0xbfb35520) at XlibInt.c:2886
#2 0xb775bb63 in _XReply (dpy=0x8057900, rep=0xbfb35520, extra=0,
discard=1)
at XlibInt.c:1815
#3 0xb775b39a in _XGetMiscCode (dpy=0x8057900) at XlibInt.c:1491
#4 0xb775b40c in _XIDHandler (dpy=0x8057900) at XlibInt.c:1506
#5 0xb77812f5 in XCreatePixmap (dpy=0x8057900, d=3216200784, width=168,
height=47, depth=24) at CrPixmap.c:61
#6 0xb7b67d04 in IA__gdk_pixmap_new (drawable=0x80610c8, width=168,
height=47, depth=24) at gdkpixmap-x11.c:175
#7 0xb7b42a32 in IA__gdk_window_begin_paint_region (window=0x80610c8,
region=0x80d32e0) at gdkwindow.c:976
#8 0xb7ceb563 in IA__gtk_main_do_event (event=0xbfb356f0) at gtkmain.c:1377
#9 0xb7b4589e in gdk_window_process_updates_internal (window=0x80610c8)
at gdkwindow.c:2303
#10 0xb7b459ee in IA__gdk_window_process_all_updates () at gdkwindow.c:2366
#11 0xb7c49e1e in gtk_container_idle_sizer (data=0x0) at gtkcontainer.c:1113
#12 0xb79906c3 in g_idle_dispatch (source=0x80cefa8, callback=0x8057900,
user_data=0xbfb35450) at gmain.c:3796
#13 0xb798d652 in g_main_dispatch (context=0x8077a00) at gmain.c:1916
#14 0xb798e6d8 in IA__g_main_context_dispatch (context=0x8077a00)
at gmain.c:2466
#15 0xb798ea10 in g_main_context_iterate (context=0x8077a00, block=1,
dispatch=1, self=0x8092ed0) at gmain.c:2547
#16 0xb798efb3 in IA__g_main_loop_run (loop=0x80cd498) at gmain.c:2751
#17 0xb7ceae33 in IA__gtk_main () at gtkmain.c:999
#18 0x080490a8 in main ()
(gdb) c
Continuing.
fcm ignoring 'BadRequest (invalid request code or no such operation)'
(serial 23494456 error_code 1 request_code 0 minor_code 0 )
Xlib: resource ID allocation space exhausted!
.... more x-errors
//#include <config.h>
#include <gtk/gtk.h>
#include <unistd.h>
#include <pthread.h>
#include <gdk/gdkx.h>
GtkWidget *window;
GtkWidget *label;
GtkWidget *foreground_fixed;
GtkWidget *main_fixed;
int x=0;
gint timer_tag = 0;
pthread_t th;
pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
void *f_th(void *arg){
for(;;){
pthread_mutex_lock(&mtx);
x++;
pthread_mutex_unlock(&mtx);
usleep(10);
}
}
static gboolean timer_function(gpointer data){
gchar *str;
int i,v;
pthread_mutex_lock(&mtx);
v=x;
pthread_mutex_unlock(&mtx);
//printf("%d\n",x);
// for(i=0;i<3;i++){
str=g_strdup_printf( "<span font_desc=\"Century Gothic 36\n\" foreground=\"#101c38\"><b>x=%d</b></span>\0",
v);
gtk_label_set_markup( GTK_LABEL(label), str);
g_free(str);
// }
return TRUE;
}
static int error_cnt =0;
static int fcm_x_error (Display *display, XErrorEvent *error){
gchar buf[64];
gchar *msg;
if (error->error_code){
XGetErrorText (display, error->error_code, buf, 63);
fprintf(stderr,"fcm ignoring '%s' (serial %ld error_code %d request_code %d minor_code %d )\n",
buf, error->serial, error->error_code,
error->request_code, error->minor_code);
if(++error_cnt>20)exit(1);
}
return 0;
}
int main(int argc,char **argv){
gchar *str;
gtk_init (&argc, &argv);
pthread_create(&th,0, f_th,0);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
main_fixed = gtk_fixed_new ();
gtk_widget_show (main_fixed);
gtk_container_add (GTK_CONTAINER (window), main_fixed);
foreground_fixed = gtk_fixed_new ();
gtk_widget_show (foreground_fixed);
gtk_fixed_put (GTK_FIXED (main_fixed), foreground_fixed, 0, 0);
gtk_widget_set_size_request (foreground_fixed, 800, 600);
label = gtk_label_new( "<span font_desc=\"Century Gothic 36\n\" foreground=\"#101c38\"><b> 0
</b></span>\0");
//gtk_container_add (GTK_CONTAINER (window), label);
gtk_fixed_put (GTK_FIXED (foreground_fixed), label, 32, 336);
//gtk_widget_set_size_request (label, 88, 48);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
timer_tag = g_timeout_add(10, timer_function, NULL);
gtk_widget_show_all(window);
XSetErrorHandler (fcm_x_error);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]