Re: [Vala] Segmentation fault, gtk app. I'm doing something really stupid I'm sure.




On mer, 2008-03-19 at 10:09 -0400, Mike Thorn wrote:

I'm pretty new to vala and am trying to make a basic web browser using
webkit. At first I simply ported over the GtkLauncher app that comes
with webkit, which worked great. Right now I'm trying to add tabs to
it. 

I am new too, so take my reply with a bit of caution.

code is here: http://pastebin.com/m1c105a3d

I think it is an unitialized array, as you suppose, but I would
reorganize your code with a struct, and use ArrayList (because you
shoule declare the array size in advance, while ArrayList is dynamic):

struct Tab {
 public Label label,
 public ScrolledWindow window,
 public WebKit.WebView view,
 public WebKit.WebFrame frame
};

private ArrayList<Tab> tab_list;

construct {
 this.tab_list = new ArrayList<Tab>;
}

public void append_new_browser_window(string url_to_load)
{
 tab_count++;
 tab_list[tab_count].label = new Label("...");
 tab_list[tab_count].window = new ScrolledWindow(null, null);
 ...
}

As I said, I am a noob, so maybe there are errors or better ways to do
it. Hope someone more expert corrects me :)

Bye.

-- 
Alessandro Pellizzari





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