GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Jul 28, 2014 10:21 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: gtk_window_move causes segmentation fault
PostPosted: Sun May 20, 2007 10:54 am 
Offline

Joined: Sun May 20, 2007 10:40 am
Posts: 3
Hello,
I'm writing small demo application to test moving a window. I use C, GObject, and GTK+.

My source code is here:
Code:
#include <gtk/gtk.h>

int
main (int argc, char **argv)
{
  g_type_init();
  GtkWindow *mainwin;
  gtk_set_locale ();
  gtk_init (&argc, &argv);

  mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_show_all (GTK_WIDGET(mainwin));
  gtk_window_move (mainwin, 100, 100);
  gtk_main ();
  return 0;
}

Call for function gtk_window_move causes segmentation fault. Could it be caused by improper GObject use?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 11:39 am 
Offline
Familiar Face

Joined: Tue Feb 13, 2007 3:45 pm
Posts: 30
Location: Madrid, Spain
You should make 'mainwindow' a GtkWidget pointer instead of a GtkWindow one, and then cast it to a GTK_WINDOW when you call gtk_window_move. But, aside from that, your code runs well on my machine.

_________________
David Vilches


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 12:19 pm 
Offline

Joined: Sun May 20, 2007 10:40 am
Posts: 3
Thank you. That is strange. I use CMake for setting compiler and linker options and I had to add reference to gtk-x11-2.0 library manually.

Could you please post ldd output with my program? Perhaps I link with bad library. :(


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 12:49 pm 
Offline

Joined: Sun May 20, 2007 10:40 am
Posts: 3
I got it working using compiler optins generated by pkgconfig. It looks like an error in CMake configuration script. Thanks. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 2:48 pm 
Offline
Familiar Face

Joined: Tue Feb 13, 2007 3:45 pm
Posts: 30
Location: Madrid, Spain
You're welcome :).

_________________
David Vilches


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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