examples: Make xoverlay installation thread safe using the GDK lock.

We can't call into the GDK functions in our sync-message handler
without taking the GDK lock, so do so.

Partially fixes #581737
This commit is contained in:
Jan Schmidt 2009-05-06 23:38:08 +01:00 committed by Edward Hervey
parent 873d51b345
commit 7743f1ad1e
4 changed files with 13 additions and 0 deletions

View file

@ -8,12 +8,14 @@ pygtk.require('2.0')
import sys
import gobject
gobject.threads_init()
import pygst
pygst.require('0.10')
import gst
import gst.interfaces
import gtk
gtk.gdk.threads_init()
class GstPlayer:
def __init__(self, videowidget):
@ -33,9 +35,11 @@ class GstPlayer:
return
if message.structure.get_name() == 'prepare-xwindow-id':
# Sync with the X server before giving the X-id to the sink
gtk.gdk.threads_enter()
gtk.gdk.display_get_default().sync()
self.videowidget.set_sink(message.src)
message.src.set_property('force-aspect-ratio', True)
gtk.gdk.threads_leave()
def on_message(self, bus, message):
t = message.type

View file

@ -15,6 +15,7 @@ pygst.require('0.10')
import gst
import gst.interfaces
import gtk
gtk.gdk.threads_init()
class GstPlayer:
def __init__(self, videowidget):
@ -33,9 +34,11 @@ class GstPlayer:
return
if message.structure.get_name() == 'prepare-xwindow-id':
# Sync with the X server before giving the X-id to the sink
gtk.gdk.threads_enter()
gtk.gdk.display_get_default().sync()
self.videowidget.set_sink(message.src)
message.src.set_property('force-aspect-ratio', True)
gtk.gdk.threads_leave()
def on_message(self, bus, message):
t = message.type

View file

@ -15,6 +15,7 @@ pygst.require('0.10')
import gst
import gst.interfaces
import gtk
gtk.gdk.threads_init()
class SwitchTest:
def __init__(self, videowidget):
@ -36,9 +37,11 @@ class SwitchTest:
return
if message.structure.get_name() == 'prepare-xwindow-id':
# Sync with the X server before giving the X-id to the sink
gtk.gdk.threads_enter()
gtk.gdk.display_get_default().sync()
self.videowidget.set_sink(message.src)
message.src.set_property('force-aspect-ratio', True)
gtk.gdk.threads_leave()
def on_message(self, bus, message):
t = message.type

View file

@ -15,6 +15,7 @@ pygst.require('0.10')
import gst
import gst.interfaces
import gtk
gtk.gdk.threads_init()
class GstPlayer:
def __init__(self, videowidget):
@ -33,9 +34,11 @@ class GstPlayer:
return
if message.structure.get_name() == 'prepare-xwindow-id':
# Sync with the X server before giving the X-id to the sink
gtk.gdk.threads_enter()
gtk.gdk.display_get_default().sync()
self.videowidget.set_sink(message.src)
message.src.set_property('force-aspect-ratio', True)
gtk.gdk.threads_leave()
def on_message(self, bus, message):
t = message.type