Re: [Vala] Seg fault when trying to pass args to gtk_init_check.




If argsv is supposed to represent a string array, Max.get_args() has
been bound incorrectly. Use string[] if you mean string array - or
char** if you have to use raw pointers but char*** is most likely wrong
here. The correct binding is probably something like:

Ok I've explained my self wrong.
The reason I use a pointer to string[] instead of just storing it, is that I want
the plugins init calls, Gtk.init_check for example, is that I want Gtk to
remove arguments which Gtk familiar with.
Then, when other init () invoked, they remove the familiar args.
In the end, the user returns to the main, and if unrecognized arguments
had left, the main shows error "Unrecognized argument".

Now this all thing can be done only if I use a pointer which points it to the
args variable in the main function:
main (string[] args)

This binding is not ideal. I recommend you to use Gtk.init_check() from
the GTK+ bindings shipped with Vala.

I splited up the length pointer and the argsv pointer since I don't know how
to manage this all thing in one pointer in Vala, but I do take it as an 
disadvantage if I must to.

Thanks
Tal

Subject: Re: [Vala] Seg fault when trying to pass args to gtk_init_check.
From: j bitron ch
To: tal_hd hotmail com
CC: vala-list gnome org
Date: Mon, 16 Jul 2012 18:23:29 +0200

Hi Tal,

On Mon, 2012-07-16 at 18:02 +0300, Tal Hadad wrote:
    int* argsc;
    char*** argsv;
    argsv = Max.get_args (out argsc);

If argsv is supposed to represent a string array, Max.get_args() has
been bound incorrectly. Use string[] if you mean string array - or
char** if you have to use raw pointers but char*** is most likely wrong
here. The correct binding is probably something like:

      public static string[] get_args ();

extern bool gtk_init_check (int *argc, char ***argv);

This binding is not ideal. I recommend you to use Gtk.init_check() from
the GTK+ bindings shipped with Vala.

      Gtk.init_check (ref args);

Regards,
Jürg

                                          


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