GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Jul 31, 2014 3:33 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: gtk glade question
PostPosted: Wed Sep 05, 2012 2:44 am 
Offline
Familiar Face

Joined: Wed Sep 05, 2012 2:02 am
Posts: 7
Hello Ladies, Sir's;
I'm a hobbyst programmer, only 2 months in linux world, can code only in assembly and english is not my mother language, so, be patience, I'm trying to do my best to explain.
I have coded a simple window example using gtk, without using glade, from a tutorial that I have found on the net writed in C, translated it to asm and it worked. After, my next goal is to create the same program, but now, using glade to draw the window. So, I have coded it and it worked.
Generally; from the C point of view, you end your program with "return", and after that the program end.
The last line of code, "call exit" function to terminate the process. So, I have tried change that call to a "syscall sys_exit", but the program does not terminate, stay like a zoombie process, I think that the program expect some signal or something that I cannot know how to deal.
The question is:
How can I end the pseudo code below using syscall sys_exit (__NR 60) ?

Code:
.code
align 16
_start:
   gtk_init,0,0
   gtk_builder_new
   mov builder,rax
   gtk_builder_add_from_file,builder,offset tut,0
   gtk_builder_get_object,builder,offset win
   mov window,rax
   gtk_builder_connect_signals,builder,0
   gtk_widget_show,window
   gtk_main
   exit,0   ;<---- here is the point, this work fine, but if I use "sys_exit,0" does not work
end _start

the glade file used:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<glade-interface>
  <!-- interface-requires gtk+ 2.24 -->
  <!-- interface-naming-policy project-wide -->
  <widget class="GtkWindow" id="window1">
    <property name="can_focus">False</property>
    <property name="events"></property>
    <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
  </widget>
</glade-interface>


Thank you for your patience. If need I can post all the source, or more details. Thanks in advance.


Top
 Profile  
 
 Post subject: Re: gtk glade question
PostPosted: Wed Sep 05, 2012 8:44 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 734
Location: UK
Hi,

This seams to be more of a bug in the parent application if you have definitely got zombie processes. Note it is best to use the normal exit() when you are working with a GUI application so that proper clean up can be done afterwards as the system _exit() will not be able to do that.

I would also try to learn a higher level language rather than use assembly. You would be less likely to produce errors and in the long run it would be easier and give you more portable code.

_________________
E.


Top
 Profile  
 
 Post subject: Re: gtk glade question
PostPosted: Wed Sep 05, 2012 11:31 am 
Offline
Familiar Face

Joined: Wed Sep 05, 2012 2:02 am
Posts: 7
Thanks for the reply Sr errol;
I agree with you about high level languages and portability.
That is just an exercise that I like to find a solution, because, I'm thinking here, C exit call make the low level invisible to the users, and I think that in a deeper way, in some moment, the C exit call deals with system call's to terminate the process.
Strange because, if I use other system call instead of sys_exit, let's suppose, sys_write to stdout, it works, but when I use sys_exit does not work.
I have used as an exercise, in some gtk examples, both, C exit and sys_exit, and worked. (Well, because sys_exit, portability fly out).
But, when I used that in a window template (glade), it does not have worked. I'm just curious about what is happening.
Again, thanks for the hint, be in peace.


Top
 Profile  
 
 Post subject: Re: gtk glade question
PostPosted: Wed Sep 05, 2012 12:06 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 734
Location: UK
The exit() function does much more than call _exit(). There is a function called atexit() where additional functions can be added to a list that would be called when exit() is called. GTK+ uses this is help with its clean up.

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group