From d348518c261d543e12282d516768d4f446434a42 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Tue, 7 Nov 2017 16:46:27 -0700 Subject: [PATCH] glx ply3d fixes, async_gui updates for edits, dflt vs auto kfrm fix, mask mode fix, mixer title tweaks, vwindow shm dmps, ptrace user mode segv traps --- cinelerra-5.1/cinelerra/assetpopup.C | 3 ++ cinelerra-5.1/cinelerra/autos.C | 9 +++-- cinelerra-5.1/cinelerra/cwindowtool.C | 27 ++++++--------- cinelerra-5.1/cinelerra/mwindowedit.C | 5 +++ cinelerra-5.1/cinelerra/zwindow.C | 4 ++- cinelerra-5.1/cinelerra/zwindowgui.C | 3 -- cinelerra-5.1/cinelerra/zwindowgui.h | 6 ++-- cinelerra-5.1/guicast/bcsignals.C | 6 +++- cinelerra-5.1/guicast/bcsubwindow.C | 3 +- cinelerra-5.1/guicast/bcsubwindow.h | 4 +-- cinelerra-5.1/guicast/bcsynchronous.C | 26 ++++++++------- cinelerra-5.1/guicast/bctrace.C | 46 ++++++++++++++++++++++++++ cinelerra-5.1/guicast/bctrace.h | 3 ++ cinelerra-5.1/guicast/bcwindow.C | 3 +- cinelerra-5.1/guicast/bcwindow.h | 19 +++-------- cinelerra-5.1/guicast/bcwindow3d.C | 1 - cinelerra-5.1/guicast/bcwindowbase.C | 32 +++++------------- cinelerra-5.1/guicast/bcwindowbase.h | 3 +- cinelerra-5.1/guicast/bcwindowbase.inc | 5 --- cinelerra-5.1/guicast/vframe.C | 26 ++++++++------- 20 files changed, 129 insertions(+), 105 deletions(-) diff --git a/cinelerra-5.1/cinelerra/assetpopup.C b/cinelerra-5.1/cinelerra/assetpopup.C index f5a3be2a..175494b5 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.C +++ b/cinelerra-5.1/cinelerra/assetpopup.C @@ -283,6 +283,9 @@ int AssetPopupMixer::handle_event() ZWindow *zwindow = mwindow->get_mixer(mixer); while( track ) { track->play = track->record = 0; + if( track->data_type == TRACK_VIDEO ) { + sprintf(track->title, _("Mixer %d"), zwindow->idx); + } mixer->mixer_ids.append(track->get_mixer_id()); track = track->next; } diff --git a/cinelerra-5.1/cinelerra/autos.C b/cinelerra-5.1/cinelerra/autos.C index 0ca1efcf..b895a904 100644 --- a/cinelerra-5.1/cinelerra/autos.C +++ b/cinelerra-5.1/cinelerra/autos.C @@ -288,12 +288,11 @@ Auto* Autos::get_auto_for_editing(double position) Auto *result = 0; get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result); + if( edl->session->auto_keyframes && (!result || result->is_default || + !EQUIV(track->from_units(result->position), position)) ) { //printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result); - if( !result || !EQUIV(track->from_units(result->position), position) ) { - if( edl->session->auto_keyframes ) { - position = edl->align_to_frame(position, 0); - result = insert_auto(track->to_units(position, 0)); - } + position = edl->align_to_frame(position, 0); + result = insert_auto(track->to_units(position, 0)); } //printf("Autos::get_auto_for_editing %p %p\n", first, default_auto); diff --git a/cinelerra-5.1/cinelerra/cwindowtool.C b/cinelerra-5.1/cinelerra/cwindowtool.C index 73f1f232..f3266356 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.C +++ b/cinelerra-5.1/cinelerra/cwindowtool.C @@ -789,16 +789,13 @@ void CWindowCameraGUI::create_objects() void CWindowCameraGUI::update_preview() { - mwindow->restart_brender(); - mwindow->sync_parameters(CHANGE_PARAMS); - - mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_NONE, - mwindow->edl, - 1); mwindow->gui->lock_window("CWindowCameraGUI::update_preview"); + mwindow->restart_brender(); mwindow->gui->draw_overlays(1); + mwindow->sync_parameters(CHANGE_PARAMS); mwindow->gui->unlock_window(); + mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, + CHANGE_NONE, mwindow->edl, 1); mwindow->cwindow->gui->lock_window("CWindowCameraGUI::update_preview"); mwindow->cwindow->gui->canvas->draw_refresh(); mwindow->cwindow->gui->unlock_window(); @@ -1237,16 +1234,13 @@ void CWindowProjectorGUI::create_objects() void CWindowProjectorGUI::update_preview() { + mwindow->gui->lock_window("CWindowProjectorGUI::update_preview"); mwindow->restart_brender(); mwindow->sync_parameters(CHANGE_PARAMS); - mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_NONE, - mwindow->edl, - 1); - // TODO: really need to lock the main window?? - mwindow->gui->lock_window("CWindowProjectorGUI::update_preview"); mwindow->gui->draw_overlays(1); mwindow->gui->unlock_window(); + mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, + CHANGE_NONE, mwindow->edl, 1); mwindow->cwindow->gui->lock_window("CWindowProjectorGUI::update_preview"); mwindow->cwindow->gui->canvas->draw_refresh(); mwindow->cwindow->gui->unlock_window(); @@ -2264,12 +2258,13 @@ void CWindowMaskGUI::handle_event() void CWindowMaskGUI::update_preview() { + mwindow->gui->lock_window("CWindowMaskGUI::update_preview"); mwindow->restart_brender(); mwindow->sync_parameters(CHANGE_PARAMS); + mwindow->gui->draw_overlays(1); + mwindow->gui->unlock_window(); mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_NONE, - mwindow->edl, - 1); + CHANGE_NONE, mwindow->edl, 1); mwindow->cwindow->gui->lock_window("CWindowMaskGUI::update_preview"); mwindow->cwindow->gui->canvas->draw_refresh(); mwindow->cwindow->gui->unlock_window(); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 4d77f8a9..1604256d 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -545,6 +545,7 @@ void MWindow::cut(double start, double end, double new_position) update_plugin_guis(); gui->update(1, 2, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); + awindow->gui->async_update_assets(); cwindow->playback_engine->que-> send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } @@ -894,6 +895,8 @@ void MWindow::finish_modify_handles() sync_parameters(CHANGE_EDL); update_plugin_guis(); gui->update(1, 2, 1, 1, 1, 1, 0); +// label list can be modified + awindow->gui->async_update_assets(); cwindow->update(1, 0, 0, 0, 1); } @@ -1910,6 +1913,7 @@ void MWindow::redo_entry(BC_WindowBase *calling_window_gui) save_backup(); update_plugin_states(); update_plugin_guis(); + awindow->gui->async_update_assets(); restart_brender(); gui->update(1, 2, 1, 1, 1, 1, 1); cwindow->update(1, 1, 1, 1, 1); @@ -2174,6 +2178,7 @@ void MWindow::trim_selection() update_plugin_guis(); gui->update(1, 2, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); + awindow->gui->async_update_assets(); restart_brender(); cwindow->playback_engine->que-> send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); diff --git a/cinelerra-5.1/cinelerra/zwindow.C b/cinelerra-5.1/cinelerra/zwindow.C index 29a28a1b..f3ba30f2 100644 --- a/cinelerra-5.1/cinelerra/zwindow.C +++ b/cinelerra-5.1/cinelerra/zwindow.C @@ -72,6 +72,7 @@ void Mixers::del_mixer(int idx) void Mixer::set_title(const char *tp) { + if( tp == title ) return; strncpy(title, tp, sizeof(title)); title[sizeof(title)-1] = 0; } @@ -249,8 +250,9 @@ void ZWindow::set_title(const char *tp) char *cp = title, *ep = cp + sizeof(title)-1; cp += snprintf(title, ep-cp, _("Mixer %d"), idx); if( tp ) cp += snprintf(cp, ep-cp, ": %s", tp); + else tp = title; Mixer *mixer = mwindow->edl->mixers.get_mixer(idx); - if( mixer && tp != mixer->title ) mixer->set_title(tp); + if( mixer ) mixer->set_title(title); } void ZWindow::reposition(int x, int y, int w, int h) diff --git a/cinelerra-5.1/cinelerra/zwindowgui.C b/cinelerra-5.1/cinelerra/zwindowgui.C index 46208af4..b374c2de 100644 --- a/cinelerra-5.1/cinelerra/zwindowgui.C +++ b/cinelerra-5.1/cinelerra/zwindowgui.C @@ -32,11 +32,8 @@ #include "mwindow.h" #include "mwindowgui.h" #include "playbackengine.h" -#include "playtransport.h" -#include "renderengine.h" #include "theme.h" #include "tracks.h" -#include "transportque.h" #include "zwindow.h" #include "zwindowgui.h" diff --git a/cinelerra-5.1/cinelerra/zwindowgui.h b/cinelerra-5.1/cinelerra/zwindowgui.h index ab658a91..9c1fed75 100644 --- a/cinelerra-5.1/cinelerra/zwindowgui.h +++ b/cinelerra-5.1/cinelerra/zwindowgui.h @@ -25,7 +25,9 @@ #include "bcwindow.h" #include "canvas.h" #include "mwindow.h" -#include "renderengine.inc" +#include "playbackengine.inc" +#include "zwindow.inc" +#include "zwindowgui.inc" class ZWindowGUI; class ZWindowCanvas; @@ -53,9 +55,7 @@ public: ZWindow *zwindow; ZWindowCanvas *canvas; - TransportCommand *command; PlaybackEngine *playback_engine; - RenderEngine *render_engine; int highlighted; }; diff --git a/cinelerra-5.1/guicast/bcsignals.C b/cinelerra-5.1/guicast/bcsignals.C index ddb2c864..6847fa5c 100644 --- a/cinelerra-5.1/guicast/bcsignals.C +++ b/cinelerra-5.1/guicast/bcsignals.C @@ -208,6 +208,7 @@ static void signal_entry(int signum) BC_Trace::dump_traces(); BC_Trace::dump_locks(); BC_Trace::dump_buffers(); + BC_Trace::dump_shm_stats(); BC_Trace::delete_temps(); // Call user defined signal handler @@ -354,7 +355,9 @@ static void handle_dump(int n, siginfo_t * info, void *sc) signal(SIGINT, SIG_DFL); // gotta be root, or the dump is worthless int uid = getuid(); - if( uid != 0 ) return; +// it is not necessary to be root if ptrace is allowed via: +// echo 0 > /proc/sys/kernel/yama/ptrace_scope (usually set to 1) +// if( uid != 0 ) return; ucontext_t *uc = (ucontext_t *)sc; int pid = getpid(), tid = gettid(); struct sigcontext *c = (struct sigcontext *)&uc->uc_mcontext; @@ -391,6 +394,7 @@ static void handle_dump(int n, siginfo_t * info, void *sc) fprintf(fp,"\nTRACES:\n"); BC_Trace::dump_traces(fp); fprintf(fp,"\nLOCKS:\n"); BC_Trace::dump_locks(fp); fprintf(fp,"\nBUFFERS:\n"); BC_Trace::dump_buffers(fp); + fprintf(fp,"\nSHMMEM:\n"); BC_Trace::dump_shm_stats(fp); if( BC_Signals::trap_hook ) { fprintf(fp,"\nMAIN HOOK:\n"); BC_Signals::trap_hook(fp, BC_Signals::trap_data); diff --git a/cinelerra-5.1/guicast/bcsubwindow.C b/cinelerra-5.1/guicast/bcsubwindow.C index f34a2d50..40c5e2f6 100644 --- a/cinelerra-5.1/guicast/bcsubwindow.C +++ b/cinelerra-5.1/guicast/bcsubwindow.C @@ -23,8 +23,7 @@ -BC_SubWindow::BC_SubWindow(int x, int y, int w, int h, int bg_color, int opts) - : BC_WindowBase(opts) +BC_SubWindow::BC_SubWindow(int x, int y, int w, int h, int bg_color) { this->x = x; this->y = y; diff --git a/cinelerra-5.1/guicast/bcsubwindow.h b/cinelerra-5.1/guicast/bcsubwindow.h index b99deed2..b90c8a34 100644 --- a/cinelerra-5.1/guicast/bcsubwindow.h +++ b/cinelerra-5.1/guicast/bcsubwindow.h @@ -28,9 +28,7 @@ class BC_SubWindow : public BC_WindowBase { public: - BC_SubWindow(int x, int y, int w, int h, - int bg_color=-1, - int opts=0); + BC_SubWindow(int x, int y, int w, int h, int bg_color=-1); virtual ~BC_SubWindow(); virtual int initialize(); diff --git a/cinelerra-5.1/guicast/bcsynchronous.C b/cinelerra-5.1/guicast/bcsynchronous.C index 54f5eec2..3c0e601d 100644 --- a/cinelerra-5.1/guicast/bcsynchronous.C +++ b/cinelerra-5.1/guicast/bcsynchronous.C @@ -158,12 +158,9 @@ void BC_Synchronous::quit() { if( !is_started ) return; is_started = 0; - BC_SynchronousCommand *command = new_command(); + BC_SynchronousCommand *command = BC_Synchronous::new_command(); command->command = BC_SynchronousCommand::QUIT; - command_lock->lock("BC_Synchronous::quit"); - commands.append(command); - command_lock->unlock(); - next_command->unlock(); + send_garbage(command); command->command_done->lock("BC_Synchronous::quit"); delete command; } @@ -218,7 +215,8 @@ void BC_Synchronous::handle_command_base(BC_SynchronousCommand *command) case BC_SynchronousCommand::DELETE_WINDOW: delete_window_sync(command); - break; + command->command_done->unlock(); + return; case BC_SynchronousCommand::DELETE_PIXMAP: delete_pixmap_sync(command); @@ -367,7 +365,7 @@ void BC_Synchronous::dump_shader(unsigned int handle) void BC_Synchronous::delete_window(BC_WindowBase *window) { #ifdef HAVE_GL - BC_SynchronousCommand *command = new_command(); + BC_SynchronousCommand *command = BC_Synchronous::new_command(); command->command = BC_SynchronousCommand::DELETE_WINDOW; command->window_id = window->get_id(); command->display = window->get_display(); @@ -376,6 +374,8 @@ void BC_Synchronous::delete_window(BC_WindowBase *window) command->glx_context = window->glx_win_context; send_garbage(command); + command->command_done->lock("BC_Synchronous::quit"); + delete command; #endif } @@ -384,7 +384,7 @@ void BC_Synchronous::delete_window_sync(BC_SynchronousCommand *command) #ifdef HAVE_GL int window_id = command->window_id; Display *display = command->display; - Window win = command->win; +// Window win = command->win; GLXWindow glx_win = command->glx_win; GLXContext glx_context = command->glx_context; XLockDisplay(display); @@ -435,10 +435,12 @@ void BC_Synchronous::delete_window_sync(BC_SynchronousCommand *command) table_lock->unlock(); - XDestroyWindow(display, win); + glXMakeContextCurrent(display, None, None, 0); if( glx_context ) glXDestroyContext(display, glx_context); - command->command_done->unlock(); +// causes xerror BadWindow (invalid Window parameter) +// XDestroyWindow(display, glx_win); +// win destroyed in bcwindowbase XUnlockDisplay(display); #endif } @@ -446,7 +448,7 @@ void BC_Synchronous::delete_window_sync(BC_SynchronousCommand *command) void BC_Synchronous::delete_display(BC_WindowBase *window) { #ifdef HAVE_GL - BC_SynchronousCommand *command = new_command(); + BC_SynchronousCommand *command = BC_Synchronous::new_command(); command->command = BC_SynchronousCommand::DELETE_DISPLAY; command->display = window->get_display(); @@ -520,7 +522,7 @@ void BC_Synchronous::release_pbuffer(int window_id, GLXPbuffer pbuffer) void BC_Synchronous::delete_pixmap(BC_WindowBase *window, GLXPixmap glx_pixmap, GLXContext glx_context) { - BC_SynchronousCommand *command = new_command(); + BC_SynchronousCommand *command = BC_Synchronous::new_command(); command->command = BC_SynchronousCommand::DELETE_PIXMAP; command->window_id = window->get_id(); command->display = window->get_display(); diff --git a/cinelerra-5.1/guicast/bctrace.C b/cinelerra-5.1/guicast/bctrace.C index b15cfea1..c50fff5f 100644 --- a/cinelerra-5.1/guicast/bctrace.C +++ b/cinelerra-5.1/guicast/bctrace.C @@ -399,3 +399,49 @@ void BC_Trace::dump_threads(FILE *fp) } +void BC_Trace::dump_shm_stat(const char *fn, FILE *fp) +{ + char path[BCTEXTLEN]; + sprintf(path, "/proc/sys/kernel/%s",fn); + FILE *sfp = fopen(path,"r"); + if( !sfp ) return; + uint64_t v = 0; + fscanf(sfp, "%ju", &v); + fclose(sfp); + fprintf(fp, "%s = %ju\n", fn, v); +} + +void BC_Trace::dump_shm_stats(FILE *fp) +{ + dump_shm_stat("shmall", fp); + dump_shm_stat("shmmax", fp); + dump_shm_stat("shmmni", fp); + FILE *sfp = fopen("/proc/sysvipc/shm","r"); + if( !sfp ) return; + char line[BCTEXTLEN]; + int pid = getpid(); + if( !fgets(line,sizeof(line), sfp) ) return; + int64_t used = 0, other = 0; + int n_used = 0, n_other = 0; + while( fgets(line,sizeof(line), sfp) ) { + int key, shmid, perms, cpid, lpid, uid, gid, cuid, cgid; + int64_t size, nattch, atime, dtime, ctime, rss, swap; + if( sscanf(line, + "%d %d %o %ju %u %u %ju %u %u %u %u %ju %ju %ju %ju %ju", + &key, &shmid, &perms, &size, &cpid, &lpid, &nattch, + &uid, &gid, &cuid, &cgid, &atime, &dtime, &ctime, + &rss, &swap) != 16 ) break; + if( cpid == pid ) { + used += size; + ++n_used; + } + else { + other += size; + ++n_other; + } + } + fclose(sfp); + fprintf(fp, "shmused = %jd (%d items)\n", used, n_used); + fprintf(fp, "shmother = %jd (%d items)\n", other, n_other); +} + diff --git a/cinelerra-5.1/guicast/bctrace.h b/cinelerra-5.1/guicast/bctrace.h index e92c0976..fc35817e 100644 --- a/cinelerra-5.1/guicast/bctrace.h +++ b/cinelerra-5.1/guicast/bctrace.h @@ -48,6 +48,9 @@ public: static void dump_locks(FILE *fp=stdout); static void dump_buffers(FILE *fp=stdout); static void dump_threads(FILE *fp=stdout); + + static void dump_shm_stat(const char *fn, FILE *fp=stdout); + static void dump_shm_stats(FILE *fp=stdout); }; class bc_trace_list : public List { diff --git a/cinelerra-5.1/guicast/bcwindow.C b/cinelerra-5.1/guicast/bcwindow.C index 6992bc9b..66686686 100644 --- a/cinelerra-5.1/guicast/bcwindow.C +++ b/cinelerra-5.1/guicast/bcwindow.C @@ -30,8 +30,7 @@ char BC_Window::default_x11_host[BCTEXTLEN] = ""; BC_Window::BC_Window(const char *title, int x, int y, int w, int h, int minw, int minh, int allow_resize, int private_color, int hide, int bg_color, const char *display_name, - int group_it, int options) - : BC_WindowBase(options) + int group_it) { create_window(0, title, x, y, w, h, (minw < 0) ? w : minw, (minh < 0) ? h : minh, diff --git a/cinelerra-5.1/guicast/bcwindow.h b/cinelerra-5.1/guicast/bcwindow.h index c91df362..2fec0ccc 100644 --- a/cinelerra-5.1/guicast/bcwindow.h +++ b/cinelerra-5.1/guicast/bcwindow.h @@ -28,20 +28,11 @@ class BC_Window : public BC_WindowBase { static char default_x11_host[BCTEXTLEN]; public: - BC_Window(const char *title, - int x, - int y, - int w, - int h, - int minw = -1, - int minh = -1, - int allow_resize = 1, - int private_color = 0, - int hide = 0, - int bg_color = -1, - const char *display_name = 0, - int group_it = 1, - int options = 0); + BC_Window(const char *title, int x, int y, int w, int h, + int minw = -1, int minh = -1, int allow_resize = 1, + int private_color = 0, int hide = 0, int bg_color = -1, + const char *display_name = 0, int group_it = 1); + virtual ~BC_Window(); static void set_default_x11_host(const char *host); diff --git a/cinelerra-5.1/guicast/bcwindow3d.C b/cinelerra-5.1/guicast/bcwindow3d.C index d3da09ea..57118e74 100644 --- a/cinelerra-5.1/guicast/bcwindow3d.C +++ b/cinelerra-5.1/guicast/bcwindow3d.C @@ -182,7 +182,6 @@ void BC_WindowBase::sync_unlock() GLXWindow BC_WindowBase::glx_window() { if( !glx_win ) { - top_level->options |= GLX_DISPLAY; glx_win = glXCreateWindow(top_level->display, top_level->glx_fb_config, win, 0); } return glx_win; diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 54a14796..a3719e59 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -85,9 +85,8 @@ Window XGroupLeader = 0; Mutex BC_KeyboardHandlerLock::keyboard_listener_mutex("keyboard_listener",0); ArrayList BC_KeyboardHandler::listeners; -BC_WindowBase::BC_WindowBase(int opts) +BC_WindowBase::BC_WindowBase() { - this->options = opts; //printf("BC_WindowBase::BC_WindowBase 1\n"); BC_WindowBase::initialize(); } @@ -147,13 +146,13 @@ BC_WindowBase::~BC_WindowBase() delete pixmap; +//printf("delete glx=%08x, win=%08x %s\n", (unsigned)glx_win, (unsigned)win, title); #ifdef HAVE_GL - if( get_resources()->get_synchronous() && - (top_level->options & GLX_WINDOW) && glx_win != 0 ) + if( get_resources()->get_synchronous() && glx_win != 0 ) { get_resources()->get_synchronous()->delete_window(this); - else + } #endif - XDestroyWindow(top_level->display, win); + XDestroyWindow(top_level->display, win); if(bg_pixmap && !shared_bg_pixmap) delete bg_pixmap; if(icon_pixmap) delete icon_pixmap; @@ -213,28 +212,15 @@ BC_WindowBase::~BC_WindowBase() XvUngrabPort(display, xvideo_port_id, CurrentTime); unlock_window(); -// Can't close display if another thread is waiting for events. -// Synchronous thread must delete display it owns a GLX_WINDOW // Must be last reference to display. -#ifndef SINGLE_THREAD -#ifdef HAVE_GL - if( (options & GLX_DISPLAY) != 0 && get_resources()->get_synchronous() ) { - printf(_("BC_WindowBase::~BC_WindowBase window deleted but opengl deletion is not\n" - "implemented for BC_Pixmap.\n")); - get_resources()->get_synchronous()->delete_display(this); - } - else -#endif - { // _XftDisplayInfo needs a lock. - get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase"); - XCloseDisplay(display); - get_resources()->create_window_lock->unlock(); - } + get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase"); + XCloseDisplay(display); + get_resources()->create_window_lock->unlock(); + // clipboard uses a different display connection clipboard->stop_clipboard(); delete clipboard; -#endif // SINGLE_THREAD } resize_history.remove_all_objects(); diff --git a/cinelerra-5.1/guicast/bcwindowbase.h b/cinelerra-5.1/guicast/bcwindowbase.h index c765b282..717f2545 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.h +++ b/cinelerra-5.1/guicast/bcwindowbase.h @@ -129,7 +129,7 @@ public: class BC_WindowBase : public trace_info { public: - BC_WindowBase(int opts=0); + BC_WindowBase(); virtual ~BC_WindowBase(); friend class BC_Bar; @@ -738,7 +738,6 @@ private: // Popup window for tooltip BC_Popup *tooltip_popup; // If this subwindow has already shown a tooltip since the last EnterNotify - int options; int flash_enabled; diff --git a/cinelerra-5.1/guicast/bcwindowbase.inc b/cinelerra-5.1/guicast/bcwindowbase.inc index c0bcff5a..e3f68802 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.inc +++ b/cinelerra-5.1/guicast/bcwindowbase.inc @@ -31,11 +31,6 @@ class BC_WindowList; // Milliseconds before cursor disappears during video playback #define VIDEO_CURSOR_TIMEOUT 2000 -// Window options -#define WINDOW_UTF8 0x0001 -//used to flag top_level window in glx_window / glXCreateWindow -#define GLX_DISPLAY 0x0002 - // mouse wheel #define WHEEL_UP 4 #define WHEEL_DOWN 5 diff --git a/cinelerra-5.1/guicast/vframe.C b/cinelerra-5.1/guicast/vframe.C index 2573e56b..d05ff849 100644 --- a/cinelerra-5.1/guicast/vframe.C +++ b/cinelerra-5.1/guicast/vframe.C @@ -499,27 +499,29 @@ int VFrame::allocate_data(unsigned char *data, int shmid, } else { memory_type = VFrame::PRIVATE; + this->data = 0; int size = calculate_data_size(this->w, this->h, this->bytes_per_line, this->color_model); if(BC_WindowBase::get_resources()->use_vframe_shm() && use_shm) { this->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777); - if(this->shmid < 0) { - printf("VFrame::allocate_data %d could not allocate shared memory\n", __LINE__); - } - - this->data = (unsigned char*)shmat(this->shmid, NULL, 0); -//printf("VFrame::allocate_data %d %d %d\n", __LINE__, size, this->shmid); - -//printf("VFrame::allocate_data %d %p\n", __LINE__, this->data); + if( this->shmid >= 0 ) { + this->data = (unsigned char*)shmat(this->shmid, NULL, 0); +//printf("VFrame::allocate_data %d %d %d %p\n", __LINE__, size, this->shmid, this->data); // This causes it to automatically delete when the program exits. - shmctl(this->shmid, IPC_RMID, 0); + shmctl(this->shmid, IPC_RMID, 0); + } + else { + printf("VFrame::allocate_data %d could not allocate" + " shared memory, %dx%d (model %d) size=0x%08x\n", + __LINE__, w, h, color_model, size); + BC_Trace::dump_shm_stats(stdout); + } } - else { // Have to use malloc for libpng -//printf("==vframe %d from %p\n", size, __builtin_return_address(0)); + if( !data ) { this->data = (unsigned char *)malloc(size); + this->shmid = -1; } - // Memory check // if(this->w * this->h > 1500 * 1100) // printf("VFrame::allocate_data 2 this=%p w=%d h=%d this->data=%p\n", -- 2.26.2