[Gtk-sharp-list] segfault on void object

Fredrik Nilsson jymdman at gmail.com
Mon Mar 26 15:47:29 EDT 2007


Hi

I'm not sure if this will work, as I can't test this right now.
But I think you need to change your code to the following:

private void OnDeleteEvent(object sender, DeleteEventArgs args) {
    this.Hide();
    args.RetVal = true;
}

If you don't set RetVal to true, your window will be destroyed and you 
have to create a new instance.

/Fredrik
              


Martin Persenius wrote:
> Hi! I thought this was really standard/simple functionality, so I have 
> no idea how to solve this. Relevant code (abbreviated) and error 
> message included below. Error happens every time.
>
> Thanks!
>
> Take care,
> Martin
>
>   1.
>       namespace GSokoban {
>   2.
>               public class MainWindow : Gnome.Window {
>   3.
>                       private SettingsWindow settings_window;
>   4.
>        
>   5.
>                       public MainWindow() {
>   6.
>                               Glade. XML gxml = new
>       <http://www.google.com/search?q=new+msdn.microsoft.com>
>       Glade.XML( null , "gsokoban-2.glade", "main_window", null);
>   7.
>                               gxml. Autoconnect(this);
>   8.
>                              
>   9.
>                               settings_window = new
>       <http://www.google.com/search?q=new+msdn.microsoft.com>
>       SettingsWindow( );
>  10.
>                       }
>  11.
>        
>  12.
>                       private void OnSettingsActivate(object sender,
>       EventArgs args) {
>  13.
>                               settings_window. Show();
>  14.
>                       }
>  15.
>               }
>  16.
>              
>  17.
>               public class SettingsWindow : Gtk.Window {
>  18.
>                       private Gtk.Window settings_window;
>  19.
>                      
>  20.
>                       public SettingsWindow() : base(WindowType.
>       Toplevel) {
>  21.
>                               base.Name = "settings_window";
>  22.
>                               base.Title = "Settings";
>  23.
>       [.......]
>  24.
>                               base.Add (settings_vbox1);
>  25.
>                               settings_vbox1.Show();
>  26.
>                       }
>  27.
>        
>  28.
>                       private void OnDeleteEvent(object sender,
>       DeleteEventArgs args) {
>  29.
>                               this.Hide();
>  30.
>                       }
>  31.
>               }
>  32.
>       }
>  33.
>        
>  34.
>       ERROR:
>  35.
>       DEBUG: OnSettingsActivate
>  36.
>       OnDeleteEvent
>  37.
>       DEBUG: OnSettingsActivate
>  38.
>       Stacktrace:
>  39.
>        
>  40.
>         at (wrapper managed-to-native) Gtk.Widget.gtk_widget_show
>       (intptr) <0x00004>
>  41.
>         at (wrapper managed-to-native ) Gtk.Widget.gtk_widget_show
>       (intptr ) <0xffffffff>
>  42.
>         at Gtk.Widget.Show () <0x0001a>
>  43.
>         at GSokoban.MainWindow.OnSettingsActivate (object,System
>       .EventArgs) [0x0000a] in /home/pmfp/Projects/gsokoban-2/gsokoban
>       -2/windows.cs:47
>  44.
>         at (wrapper delegate-invoke) System
>       .MulticastDelegate.invoke_void_object_EventArgs
>       (object,System.EventArgs ) <0xffffffff>
>  45.
>         at GLib.Signal.voidObjectCallback (intptr,intptr ) <0x00093>
>  46.
>         at (wrapper native-to-managed) GLib.Signal. voidObjectCallback
>       (intptr,intptr) <0xffffffff>
>  47.
>         at (wrapper managed-to-native ) Gtk.Application.gtk_main ()
>       <0x00004>
>  48.
>         at ( wrapper managed-to-native) Gtk.Application.gtk_main ()
>       <0xffffffff>
>  49.
>         at Gtk.Application.Run () <0x00007>
>  50.
>         at GSokoban. GSokoban.Main (string[]) [0x0002c ] in
>       /home/pmfp/Projects/gsokoban-2/gsokoban-2/gsokoban-2.cs:54
>  51.
>         at (wrapper runtime-invoke)
>       System.Object.runtime_invoke_void_string []
>       (object,intptr,intptr,intptr) <0xffffffff>
>  52.
>        
>  53.
>       Native stacktrace:
>  54.
>        
>  55.
>               mono [0x8179af1]
>  56.
>               mono [0x815c62b]
>  57.
>               [0xb7f49440 ]
>  58.
>               [0xb5f9bb60]
>  59.
>               [0xb5f9bb1b ]
>  60.
>               [0xb61e06a8]
>  61.
>               [0xb61d8047 ]
>  62.
>               [0xb5f9e07c]
>  63.
>               [0xb61e066b ]
>  64.
>              
>       /usr/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x4b
>       ) [0xb69e9e1b]
>  65.
>               /usr/lib/libgobject-2.0.so .0(g_closure_invoke+0x13b)
>       [0xb69dc98b]
>  66.
>               /usr/lib/libgobject -2.0.so.0 [0xb69ed213]
>  67.
>               /usr/lib/libgobject-2.0
>       .so.0(g_signal_emit_valist+0x899) [0xb69ee429]
>  68.
>               /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [
>       0xb69ee5d9]
>  69.
>               /usr/lib/libgtk-x11-2.0.so.0(gtk_widget_activate+0x92 )
>       [0xb6e00042]
>  70.
>               /usr/lib/libgtk-x11-2.0.so
>       .0(gtk_menu_shell_activate_item+0x122) [0xb6d1e262]
>  71.
>               /usr/lib/libgtk-x11 -2.0.so.0 [0xb6d1f810]
>  72.
>               /usr/lib/libgtk-x11 -2.0.so.0 [0xb6d13d3f]
>  73.
>               /usr/lib/libgtk-x11-2.0
>       .so.0(_gtk_marshal_BOOLEAN__BOXED+0x60) [0xb6d12250]
>  74.
>               /usr/lib/libgobject-2.0.so.0 [0xb69daf49]
>  75.
>               /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x13b)
>       [0xb69dc98b ]
>  76.
>               /usr/lib/libgobject-2.0.so.0 [0xb69ed56f ]
>  77.
>               /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x678
>       ) [0xb69ee208]
>  78.
>               /usr/lib/libgobject-2.0.so.0 (g_signal_emit+0x29)
>       [0xb69ee5d9]
>  79.
>               /usr/lib/libgtk-x11 -2.0.so.0 [0xb6dfbf64]
>  80.
>               /usr/lib/libgtk-x11-2.0 .so.0(gtk_propagate_event+0x193)
>       [0xb6d0bbd3]
>  81.
>               /usr/lib/libgtk-x11-2.0.so.0(gtk_main_do_event+0x327)
>       [0xb6d0ce07]
>  82.
>               /usr/lib/libgdk-x11-2.0.so.0 [ 0xb6b8feea]
>  83.
>               /usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x181
>       ) [0xb7ec8731]
>  84.
>               /usr/lib/libglib-2.0.so .0 [0xb7ecb7a6]
>  85.
>               /usr/lib/libglib-2.0.so.0 (g_main_loop_run+0x1b7)
>       [0xb7ecbb67]
>  86.
>               /usr/lib/libgtk-x11 -2.0.so.0(gtk_main+0xc1) [0xb6d0d281]
>  87.
>               [0xb5f9d045]
>  88.
>               [0xb5f9d008]
>  89.
>               [0xb748c958]
>  90.
>               [0xb748c7c3]
>  91.
>               mono [0x815c4f6]
>  92.
>               mono(mono_runtime_invoke+0x27) [0x80f892f]
>  93.
>               mono(mono_runtime_exec_main+0x142) [ 0x80fd289]
>  94.
>               mono(mono_runtime_run_main+0x276) [0x80fd52f ]
>  95.
>               mono(mono_jit_exec+0xbd) [0x80588cd]
>  96.
>               mono [0x80589aa]
>  97.
>               mono(mono_main+0x165b) [0x805a194]
>  98.
>               mono [0x8057ab6]
>  99.
>               /lib/tls/i686/cmov/libc. so.6(__libc_start_main+0xc8)
>       [0xb7d3fea8]
> 100.
>               mono [0x8057a11]
> 101.
>        
> 102.
>       Debug info from gdb:
> 103.
>        
> 104.
>       Using host libthread_db library
>       "/lib/tls/i686/cmov/libthread_db.so.1".
> 105.
>       [Thread debugging using libthread_db enabled]
> 106.
>       [ New <http://www.google.com/search?q=new+msdn.microsoft.com>
>       Thread -1210931520 (LWP 14212)]
> 107.
>       [New <http://www.google.com/search?q=new+msdn.microsoft.com>
>       Thread -1219974224 (LWP 14217 )]
> 108.
>       [New <http://www.google.com/search?q=new+msdn.microsoft.com>
>       Thread -1214268496 (LWP 14216)]
> 109.
>       0xb7f49410 in ?? ()
> 110.
>         3 Thread -1214268496 (LWP 14216)  0xb7f49410 in ?? ( )
> 111.
>         2 Thread -1219974224 (LWP 14217)  0xb7f49410 in ?? ()
> 112.
>         1 Thread -1210931520 ( LWP 14212)  0xb7f49410 in ?? ()
> 113.
>        
> 114.
>       Thread 3 (Thread -1214268496 (LWP 14216) ):
> 115.
>       #0  0xb7f49410 in ?? ()
> 116.
>       #1  0xb79fb458 in ?? ()
> 117.
>       #2  0x0821d3a8 in ?? ()
> 118.
>       #3  0x00000000 in ?? ()
> 119.
>        
> 120.
>       Thread 2 (Thread -1219974224 (LWP 14217)):
> 121.
>       #0  0xb7f49410 in ?? ()
> 122.
>       #1  0xb748a288 in ?? ()
> 123.
>       #2  0x0000000b in ?? ()
> 124.
>       #3  0x00000000 in ?? ()
> 125.
>        
> 126.
>       Thread 1 (Thread -1210931520 (LWP 14212)):
> 127.
>       #0  0xb7f49410 in ?? ()
> 128.
>       #1  0xbfe5898c in ?? ()
> 129.
>       #2  0x00000000 in ?? ()
> 130.
>       #0  0xb7f49410 in ?? ()
> 131.
>        
> 132.
>        
> 133.
>       =================================================================
> 134.
>       Got a SIGSEGV while executing native code. This usually indicates
> 135.
>       a fatal error in the mono runtime or one of the native libraries
> 136.
>       used by your application.
> 137.
>       =================================================================
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>   



More information about the Gtk-sharp-list mailing list