From 3965a828148131904d4ede4354b0942917a107b3 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Mon, 16 May 2016 12:18:53 -0600 Subject: [PATCH] prevent death by zombie --- cinelerra-5.1/guicast/bcbitmap.h | 1 + cinelerra-5.1/guicast/test4.C | 10 +++++----- cinelerra-5.1/guicast/vframe.C | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cinelerra-5.1/guicast/bcbitmap.h b/cinelerra-5.1/guicast/bcbitmap.h index 1d89a44d..88d777b3 100644 --- a/cinelerra-5.1/guicast/bcbitmap.h +++ b/cinelerra-5.1/guicast/bcbitmap.h @@ -261,6 +261,7 @@ public: int is_xwindow() { return type==bmXShmImage || type==bmXImage; } int is_shared() { return type==bmXvShmImage || type==bmXShmImage; } int is_unshared() { return type==bmXvImage || type==bmXImage; } + int is_zombie() { return cur_bfr()->is_zombie(); } int set_bg_color(int color); int invert(); diff --git a/cinelerra-5.1/guicast/test4.C b/cinelerra-5.1/guicast/test4.C index 6e9d27f7..0c2c2fdd 100644 --- a/cinelerra-5.1/guicast/test4.C +++ b/cinelerra-5.1/guicast/test4.C @@ -1,5 +1,5 @@ -//c++ -g -I../guicast testwindow.C ../guicast/x86_64/libguicast.a \ +//c++ -g -I../guicast test4.C ../guicast/x86_64/libguicast.a \ // -DHAVE_GL -DHAVE_XFT -I/usr/include/freetype2 -lGL -lX11 -lXext \ // -lXinerama -lXv -lpng -lfontconfig -lfreetype -lXft -pthread @@ -119,7 +119,7 @@ int main(int ac, char **av) struct stat st; fstat(fd,&st); unsigned char *dat = new unsigned char[st.st_size]; read(fd, dat, st.st_size); - VFrame ifrm(dat, st.st_size); + VFramePng ifrm(dat, st.st_size); delete [] dat; close(fd); int w = ifrm.get_w(), h = ifrm.get_h(); @@ -141,9 +141,9 @@ int main(int ac, char **av) cfrm.transfer_from(&bfrm, 0); printf("xfer_%s_to_%s\n",cmdl[fr_cmdl],cmdl[to_cmdl]); test_window.show_text(50,50, "xfer_%s_to_%s",cmdl[fr_cmdl],cmdl[to_cmdl]); - write_pgm(cfrm.get_data(), w,h, "/tmp/test/xfer_%s_to_%s.pgm", - cmdl[fr_cmdl],cmdl[to_cmdl]); - //usleep(100000); +// write_ppm(cfrm.get_data(), w,h, "/tmp/test/xfer_%s_to_%s.pgm", +// cmdl[fr_cmdl],cmdl[to_cmdl]); +// usleep(100000); } } test_window.close_window(); diff --git a/cinelerra-5.1/guicast/vframe.C b/cinelerra-5.1/guicast/vframe.C index 36418704..e5d37597 100644 --- a/cinelerra-5.1/guicast/vframe.C +++ b/cinelerra-5.1/guicast/vframe.C @@ -536,7 +536,7 @@ void VFrame::set_memory(BC_Bitmap *bitmap) { int shmid = 0; unsigned char *data = 0; - if( bitmap->is_shared() ) + if( bitmap->is_shared() && !bitmap->is_zombie() ) shmid = bitmap->get_shmid(); else data = bitmap->get_data(); -- 2.26.2