Re: [Vala] crashes app

Nor Jaidi Tuah píše v So 23. 01. 2010 v 10:39 +0800:
I don't know if this is a vala bug or I have missed something.
In the following code I'm creating a Gtk.Dialog and keeping it
handy to be shown non-modal using show(). The trouble is, after
the dialog is closed, reopening it will crash the application
with "Segmentation fault" no less.

Replacing show() with run() & hide() fixes the problem, but
the dialog is now modal (even after dialog.set_modal).

Please, please tell me I miss something.

  Gtk.Dialog dialog = null

  public void show_dialog (Gtk.Window parent) {
    if (dialog == null) {
      dialog = new Gtk.Dialog ();
      dialog.title = "Whatever";
      dialog.delete_event.connect (() => {dialog.hide_on_delete ();});

Perhaps you wanted "return dialog.hide_on_delete ();" there? I didn't do
this in a long time, bug if I recall correctly, you need to stop
delete_event by returning true.

      dialog.transient_for = parent;
      dialog.set_destroy_with_parent (true);
      dialog.vbox.set_size_request (200, 300);
      dialog.show_all ();
    } (); // this will crash when invoked after closing

Nor Jaidi Tuah

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]