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



Hi Tal,

On Mon, 2012-07-16 at 20:27 +0300, Tal Hadad wrote:
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)

I'd replace the function Max.get_args() with a variable:

namespace Max {
        unowned string[] args;
}

int main (string[] args) {
        Max.args = args;
        ... initialize plugins
        ... use Max.args instead of args
}

public void peas_register_types (ObjectModule module) {
        if (!Gtk.init_check (ref Max.args)) {
                stderr.printf ("Error: Failed to initialize Gtk.\n");
                return;
        }
        stdout.printf ("Pass first\n");
}

Regards,
Jürg




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