I found the answer. Gstreamer callbacks are being made on the pipeline thread
context. All I needed to do is put a Glib::Dispatcher to signal the app thread
context.
So now the code works in this order:
gstreamer_callback->static PlayFile method->Glib::Dispatcher(changes to the app
thread context)->another PlayFile method->signal main_window->method on
main_window that displays Gtk::MessageDialog->it works
Caution to other readers: Be careful of shared data access. In my case
scenario(gstreamer+gtkmm) use a Glib::Dispatcher to signal code which operates
on gui functions. non-gui functions operate well in the pipeline
context(especially when you call gstreamer functions).
From: [email protected]
To: [email protected]
Subject: Is this a threading issue?
Date: Wed, 9 Sep 2009 20:46:48 +0300
Hi I am developing a media player app using gtkmm and gstreamer. Unfortunately
it isn't yet in a state for sources to be released. I am encountering a problem
and I can't seem to solve it. Furthermore this problem is somewhat random. The
code occasionally works as it should, but most of the time it crashes. This
code is called after a series of signals/callbacks. I'll attempt to explain:
main_window class is a classed derived from Gtk::Window
Playfile class is my own custom class, it isn't based on any widget, it just
uses libsigc for signals
In Playfile I connect a gstreamer callback to a method of Playfile which is
static. When this method is called, it is passed a pointer to the instance of
Playfile. I use this pointer to call another method of Playfile(needed to
access the instance's vars). This method, does some work and finally it emits a
signal. This signal is catched by a method in the main_window instance. Then in
that method I create a Gtk::MessageDialog. But when I try to run() it the app
crashes(most of the time). The only error I get in the console is this:
media_player: ../../src/xcb_io.c:176: process_responses: Assertion `!(req &&
current_request && !(((long) (req->sequence) - (long) (current_request)) <=
0))' failed.
media_player is the name of the app.
I know that I haven't given you any code, but do you have any idea what is
happening? Since it sometimes works, I suspect that this is a threading
issue(in gtkmm/gtk or gstreamer). I don't use threads, the app is single
threaded. Do you have any suggestions on what to do?
Μοιραστείτε τις αναμνήσεις σας μέσω Internet με τους φίλους σας με τους φίλους
σας.
_________________________________________________________________
Έχετε Messenger; Έχετε και Windows Live. Μάθετε περισσότερα.
http://microsoft.com/windows/windowslive
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list