Hello

I'm trying to learn a bit about vala and i'm facing some unexpected warnings. 
The program itself runs as expected.

So i have file called browser.vala which i compile and run. Inside of it there 
is a class called webPlayer which contains a Webkit webView. The main loop 
periodically destroys and recreates this class.
On every destroy() i get these two messages:

(browser:23160): Gtk-CRITICAL **: IA__gtk_widget_hide: assertion `GTK_IS_WIDGET 
(widget)' failed
(browser:23160): Gtk-CRITICAL **: IA__gtk_widget_destroy: assertion 
`GTK_IS_WIDGET (widget)' failed

When run over time this simple program does already leak memory which could be 
related to the mentioned messages above.

Compile and run:
valac --pkg=gtk+-2.0 --pkg=webkit-1.0 --thread --disable-assert browser.vala && 
./browser

I would appreciate any kind of help. Thanks.


Code:

using Gtk;
using WebKit;

public class MainWindow : Window {
  WebPlayer player;

  public void run (){
    change_media ();
    Timeout.add (2000, change_media);
  }

  private bool change_media (){
    if (player != null) player.destroy ();

    player = new WebPlayer ();
    player.start ("http://www.youtube.com/embed/XSGBVzeBUbk";);
    return true;
  }

  public static int main (string[] args){
    Gtk.init (ref args);

    var window = new MainWindow ();
    window.run ();

    Gtk.main ();

    return 0;
  }
}

public class WebPlayer : Window {
  private WebView web_view;

  public WebPlayer (){
    title = "web player";
    name = "window";
    set_size_request (800, 600);
    web_view = new WebView ();
    this.add (web_view);
  }

  public void start (string url){
    web_view.open (url);
    show_all ();
  }
}
Diese E-Mail und ihre Anhänge enthalten vertrauliche und/oder rechtlich 
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
vernichten Sie diese Mail inklusive Anhänge. Das unerlaubte Kopieren sowie die 
unbefugte Weitergabe der Inhalte dieser Mail ist nicht gestattet.
This e-mail and any attachments may contain confidential and/or privileged 
information. If you are not the intended recipient (or have received this 
e-mail in error) please notify the sender immediately and destroy this e-mail 
including the attachments. Any unauthorized copying, disclosure or distribution 
of the material in this e-mail is strictly forbidden.
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to