LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-15-2005, 12:26 AM   #1
stephenwalter
Member
 
Registered: Jul 2005
Location: india,coimbatore
Distribution: Fedora core 4
Posts: 85

Rep: Reputation: 15
Unable to fix crashes in a GUI using GTK2.0


Hi,
Iam working on a client server application using c , and i have developed a GUI for my application using GTK2.0 . I face a segmentation fault sometimes but not all the times and i tried to backtrace the segmentation fault using gdb and this was what gdb traced out .

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208247840 (LWP 3244)]
0x007e4ccf in malloc_consolidate () from /lib/libc.so.6
(gdb) backtrace
#0 0x007e4ccf in malloc_consolidate () from /lib/libc.so.6
#1 0x007e608d in _int_malloc () from /lib/libc.so.6
#2 0x007e7792 in malloc () from /lib/libc.so.6
#3 0x00b48a00 in g_malloc () from /usr/lib/libglib-2.0.so.0
#4 0x00d5c9fd in pango_log2vis_get_embedding_levels () from /usr/lib/libpango-1.0.so.0
#5 0x00d4b724 in pango_context_get_base_dir () from /usr/lib/libpango-1.0.so.0
#6 0x00d4c354 in pango_itemize_with_base_dir () from /usr/lib/libpango-1.0.so.0
#7 0x00d53459 in pango_layout_iter_get_char_extents () from /usr/lib/libpango-1.0.so.0
#8 0x00d54007 in pango_layout_iter_get_char_extents () from /usr/lib/libpango-1.0.so.0
#9 0x00289d39 in gtk_text_layout_get_line_display () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x002804a3 in gtk_text_layout_draw () from /usr/lib/libgtk-x11-2.0.so.0
#11 0x00299890 in gtk_text_view_scroll_to_iter () from /usr/lib/libgtk-x11-2.0.so.0
#12 0x0020c352 in gtk_marshal_VOID__UINT_STRING () from /usr/lib/libgtk-x11-2.0.so.0
#13 0x00cbdd9b in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
#14 0x00cbe285 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#15 0x00ccc917 in g_signal_stop_emission () from /usr/lib/libgobject-2.0.so.0
#16 0x00ccdc53 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#17 0x00cce254 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#18 0x002e7ac3 in gtk_widget_activate () from /usr/lib/libgtk-x11-2.0.so.0
#19 0x0020b0cb in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#20 0x00da25ad in gdk_window_clear_area_e () from /usr/lib/libgdk-x11-2.0.so.0
#21 0x00da2680 in gdk_window_process_all_updates () from /usr/lib/libgdk-x11-2.0.so.0
#22 0x00da2701 in gdk_window_process_all_updates () from /usr/lib/libgdk-x11-2.0.so.0
#23 0x00b44650 in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
#24 0x00b423ee in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#25 0x00b453f6 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#26 0x00b456e3 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#27 0x0020a1b5 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#28 0x0804ca81 in main (argc=1, argv=0xbfdd5fb4) at menu.c:709

menu.c is where i have the entry point for my application.

Since the crash is not happening always iam not able to guess the reason for the crash. If anyone who is working on GTK2.0 or anyone who knows a way in which this can be solved please let me know. Thanking u all in anticipation.

Regards,

S.Suresh Stephen
 
Old 11-17-2005, 08:01 AM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
The more probable reason is you work with an unallocated memory. Do you use
malloc() or calloc()? Do you free() memory? May be you incorrectly (or do not
at all) assign values for pointers and, meantime, use them?
 
Old 11-19-2005, 12:06 AM   #3
stephenwalter
Member
 
Registered: Jul 2005
Location: india,coimbatore
Distribution: Fedora core 4
Posts: 85

Original Poster
Rep: Reputation: 15
Hi,
Sorry for not responding quickly i was on leave. Let me explain the issue more clearly, I have a main window which has a menu bar and in in one of the menus i have a menu item which when activated will open a window and when the ok button that i have created is pressed it will open another window and when the ok button that i have created is pressed it will open another window(so 3 windows) now what happens is for the switch from first to second window no issues from there to the third there is a crash and in gdb backtrace it points to the malloc() and some times free() or realloc() . I have not used any malloc() for creating the UI . I dont understand the reason at all. And sometimes it does not crash and application executes successfully.

Regards,

S.Suresh Stephen
 
Old 11-19-2005, 06:18 AM   #4
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
I never worked with gdb, please post there output produced by valgrind.
Otherwise, it seems, I cannot help.
 
Old 11-20-2005, 07:02 AM   #5
stephenwalter
Member
 
Registered: Jul 2005
Location: india,coimbatore
Distribution: Fedora core 4
Posts: 85

Original Poster
Rep: Reputation: 15
Hi,
Thanks for ur reply . I found the issue for the crash. The crash was rather because of an malloc() in GUI . When i changed that char pointer to an array. The issue was resolved. Thanks for ur help any way.

Regards,

S.Suresh Stephen
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: Laptop crashes when power source is changed fix bufo333 LinuxAnswers Discussion 1 02-06-2005 11:21 AM
Am iI a total noob? I Want better window Gui for gtk2 apps when working in gnome!!!!! Samppa72 Linux - Distributions 1 06-07-2004 04:46 PM
GUI fails; unable to log in tataki Mandriva 5 04-07-2004 11:57 PM
9600 Pro crashes my GUI Terroth Mandriva 2 03-08-2004 08:36 PM
unable to access GUI alcopanth Linux - Newbie 5 11-02-2003 02:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration