summaryrefslogtreecommitdiff
path: root/recordmydesktop/src
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-12-04 17:50:45 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-12-04 17:50:45 +0000
commit8c82442c6fcdc29663ad902125cb697a3f1f50e2 (patch)
treef1d5731b2eb8169b24a6c02b16c0f68cfedf487d /recordmydesktop/src
parent50c363e436ef1063baa3ddace1f29507c644237c (diff)
Added custom X error handler, to
avoid BadWindow on XGetWindowAttributes, with XQueryTree git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@210 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r--recordmydesktop/src/capture_sound.c1
-rw-r--r--recordmydesktop/src/poll_damage.c19
-rw-r--r--recordmydesktop/src/recordmydesktop.c1
3 files changed, 19 insertions, 2 deletions
diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c
index f9a7675..702d325 100644
--- a/recordmydesktop/src/capture_sound.c
+++ b/recordmydesktop/src/capture_sound.c
@@ -33,7 +33,6 @@ void *CaptureSound(ProgData *pdata){
// fprintf(stderr,"fr %d ps %d\n",frames,pdata->periodsize);fflush(stderr);
pthread_mutex_t pmut;
pthread_mutex_init(&pmut,NULL);
- pdata->sound_buffer=NULL;
while(pdata->running){
int sret=0;
diff --git a/recordmydesktop/src/poll_damage.c b/recordmydesktop/src/poll_damage.c
index 09de911..d03f78d 100644
--- a/recordmydesktop/src/poll_damage.c
+++ b/recordmydesktop/src/poll_damage.c
@@ -27,6 +27,21 @@
#include <recordmydesktop.h>
+int rmdErrorHandler( Display *dpy, XErrorEvent *e )
+{
+ char error_desc[1024];
+ XGetErrorText(dpy,e->error_code,error_desc,sizeof(error_desc));
+ fprintf(stderr,"X Error: %s\n",error_desc);
+ fflush(stderr);
+ if((e->error_code==BadWindow)&&(e->request_code==X_GetWindowAttributes)){
+ fprintf(stderr,"BadWindow on XGetWindowAttributes.\nIgnoring...");
+ fflush(stderr);
+ return 0;
+ }
+ else
+ exit(1);
+}
+
void *PollDamage(ProgData *pdata){
Window root_return,
parent_return,
@@ -36,6 +51,8 @@ void *PollDamage(ProgData *pdata){
inserts=0;
XEvent event;
+ XSetErrorHandler(rmdErrorHandler);
+
XSelectInput (pdata->dpy,pdata->specs.root, SubstructureNotifyMask);
XQueryTree (pdata->dpy,
@@ -52,7 +69,7 @@ void *PollDamage(ProgData *pdata){
XDamageCreate (pdata->dpy, children[i],XDamageReportRawRectangles);
}
}
-
+ XFree(children);
XDamageCreate( pdata->dpy, pdata->brwin.windowid, XDamageReportRawRectangles);
diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c
index ac1ea16..f15bdc9 100644
--- a/recordmydesktop/src/recordmydesktop.c
+++ b/recordmydesktop/src/recordmydesktop.c
@@ -127,6 +127,7 @@ int main(int argc,char **argv){
pthread_cond_init(&pdata.sound_buffer_ready,NULL);
pthread_cond_init(&pdata.sound_data_read,NULL);
pdata.list_selector=Paused=Aborted=pdata.avd=0;
+ pdata.sound_buffer=NULL;
pdata.running=1;
time_cond=&pdata.time_cond;
pause_cond=&pdata.pause_cond;
© All Rights Reserved