Re: [Vala] How to keep an object alive if it's going out of scope
- From: Jürg Billeter <j bitron ch>
- To: "Jaap A. Haitsma" <jaap haitsma org>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] How to keep an object alive if it's going out of scope
- Date: Mon, 02 Jun 2008 21:34:43 +0200
On Mon, 2008-06-02 at 10:41 +0200, Juerg Billeter wrote:
Hi Jaap,
On Mon, June 2, 2008 08:16, Jaap A. Haitsma wrote:
I'm working on porting cheese to vala. I'm running into a problem when
trying to convert gst-audio-play.c [1] to vala.
The gst-audio-play has a function play_file and what it does is the
following in semi vala code
public static play_file (string filename) {
var audio = new Audio (filename);
audio.play (); // Playing starts in another thread
// In vala audio gets unreffed here, but I want it to be unreffed
after it receives an EOS (end of stream) in the other thread
}
The proper fix is to use gst_bus_add_watch_full, as far as I can tell from
the code. When bug 533484[1] has been fixed and the bindings have been
adapted, this will be completely automatic and should work fine with your
current Vala code. In the meantime, you can call .ref() and .unref()
manually at the appropriate places.
The Gst.Bus.add_watch_full binding should now be able to handle the
reference counting without manual .ref() or .unref() calls.
Jürg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]