From dcdf2f77cc47ca7c543f27ddb03c4814015d974b Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sat, 20 Apr 2019 13:39:25 -0600 Subject: [PATCH] mem leaks, fix canvas_h bug, diamond for bezier entpts, aging_plugin segv, grab boundry test fix --- cinelerra-5.1/cinelerra/canvas.C | 2 +- cinelerra-5.1/cinelerra/main.C | 19 ++++++++++++++- cinelerra-5.1/cinelerra/trackcanvas.C | 24 ++++++++++++++----- cinelerra-5.1/guicast/bcresources.C | 2 ++ cinelerra-5.1/guicast/bcwindowbase.C | 8 +++---- cinelerra-5.1/guicast/bcwindowbase.h | 2 +- cinelerra-5.1/leaker.C | 2 +- cinelerra-5.1/plugins/aging/aging.C | 3 ++- cinelerra-5.1/plugins/crikey/crikeywindow.C | 8 +++---- .../plugins/sketcher/sketcherwindow.C | 10 ++++---- 10 files changed, 57 insertions(+), 23 deletions(-) diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index a01d1b9e..d536cb1f 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -600,7 +600,7 @@ void Canvas::update_geometry(EDL *edl, int x, int y, int w, int h) vw != view_w || vh != view_h ) redraw = 1; } if( !redraw ) return; - reposition_window(edl, x, y, w, y); + reposition_window(edl, x, y, w, h); } void Canvas::reposition_window(EDL *edl, int x, int y, int w, int h) diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 6f4ee2e1..6833425d 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -46,7 +46,24 @@ #include #ifdef LEAKER -#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n) +#if 0 // track allocators +#include +#define BT_BUF_SIZE 100 +static void leaker() +{ + void *buffer[BT_BUF_SIZE]; + int nptrs = backtrace(buffer, BT_BUF_SIZE); + char **trace = backtrace_symbols(buffer, nptrs); + if( !trace ) return; + for( int i=0; i y1) - { - set_color(BLACK); - draw_box(x1 + 1, y1 + 1, x2 - x1, y2 - y1); - set_color(color); - draw_box(x1, y1, x2 - x1, y2 - y1); + if( y2-1 > y1 ) { + if( current->curve_mode == FloatAuto::LINEAR ) { + draw_box(x1, y1, x2 - x1, y2 - y1); + } + else { + ArrayList polygon_x; + ArrayList polygon_y; + polygon_x.append((x1 + x2) / 2 + 1); + polygon_y.append(y1 + 1); + polygon_x.append(x2 + 1); + polygon_y.append((y1 + y2) / 2 + 1); + polygon_x.append((x1 + x2) / 2 + 1); + polygon_y.append(y2 + 1); + polygon_x.append(x1 + 1); + polygon_y.append((y1 + y2) / 2 + 1); + fill_polygon(&polygon_x, &polygon_y); + } } // show bezier control points (only) if this diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C index d44c435a..16f53f97 100644 --- a/cinelerra-5.1/guicast/bcresources.C +++ b/cinelerra-5.1/guicast/bcresources.C @@ -955,6 +955,8 @@ BC_Resources::~BC_Resources() del_vframes(default_pot_images, 3); del_vframes(default_progress_images, 2); del_vframes(default_medium_7segment, 20); + del_vframes(default_vscroll_data, 10); + del_vframes(default_hscroll_data, 10); if( fontlist ) { fontlist->remove_all_objects(); delete fontlist; diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 583caac6..5d177c93 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -728,9 +728,8 @@ int BC_WindowBase::run_window() init_lock->unlock(); // Handle common events - while(!done) - { - dispatch_event(0); + while( !done ) { + dispatch_event(); } unset_all_repeaters(); @@ -886,13 +885,14 @@ pthread_t locking_task = (pthread_t)-1L; int locking_event = -1; int locking_message = -1; -int BC_WindowBase::dispatch_event(XEvent *event) +int BC_WindowBase::dispatch_event() { Window tempwin; int result; XClientMessageEvent *ptr; int cancel_resize, cancel_translation; volatile static int debug = 0; + XEvent *event; key_pressed = 0; diff --git a/cinelerra-5.1/guicast/bcwindowbase.h b/cinelerra-5.1/guicast/bcwindowbase.h index 7dfc26fd..cd4dcd08 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.h +++ b/cinelerra-5.1/guicast/bcwindowbase.h @@ -586,7 +586,7 @@ private: XFontSet get_fontset(int font); XFontSet get_curr_fontset(void); void set_fontset(int font); - int dispatch_event(XEvent *event); + int dispatch_event(); int get_key_masks(unsigned int key_state); diff --git a/cinelerra-5.1/leaker.C b/cinelerra-5.1/leaker.C index 00987912..209d6c68 100644 --- a/cinelerra-5.1/leaker.C +++ b/cinelerra-5.1/leaker.C @@ -32,7 +32,7 @@ int main(int ac, char **av) { int64_t adr, from, sz; recd_map recds; - char line[256]; + char line[65536]; FILE *fp = stdin; while( fgets(line,sizeof(line),fp) ) { diff --git a/cinelerra-5.1/plugins/aging/aging.C b/cinelerra-5.1/plugins/aging/aging.C index 67a8023f..5517b44d 100644 --- a/cinelerra-5.1/plugins/aging/aging.C +++ b/cinelerra-5.1/plugins/aging/aging.C @@ -43,6 +43,7 @@ AgingMain::AgingMain(PluginServer *server) aging_server = 0; pits_count = 0; dust_count = 0; + memset(scratches, 0, sizeof(scratches)); } AgingMain::~AgingMain() @@ -287,7 +288,7 @@ void AgingClient::coloraging(unsigned char **output_rows, unsigned char **input_ for( i = 0; i < plugin->config.scratch_lines; i++ ) { \ if( plugin->scratches[i].life ) { \ plugin->scratches[i].x = plugin->scratches[i].x + plugin->scratches[i].dx; \ - if( plugin->scratches[i].x < 0 || plugin->scratches[i].x > w_256 ) { \ + if( plugin->scratches[i].x < 0 || plugin->scratches[i].x >= w_256 ) { \ plugin->scratches[i].life = 0; \ break; \ } \ diff --git a/cinelerra-5.1/plugins/crikey/crikeywindow.C b/cinelerra-5.1/plugins/crikey/crikeywindow.C index 8d6d8644..a00c48c4 100644 --- a/cinelerra-5.1/plugins/crikey/crikeywindow.C +++ b/cinelerra-5.1/plugins/crikey/crikeywindow.C @@ -217,12 +217,12 @@ int CriKeyWindow::do_grab_event(XEvent *event) CWindowGUI *cwindow_gui = mwindow->cwindow->gui; CWindowCanvas *canvas = cwindow_gui->canvas; int cx, cy; cwindow_gui->get_relative_cursor(cx, cy); - cx -= mwindow->theme->ccanvas_x; - cy -= mwindow->theme->ccanvas_y; + cx -= canvas->view_x; + cy -= canvas->view_y; if( !dragging ) { - if( cx < 0 || cx >= mwindow->theme->ccanvas_w || - cy < 0 || cy >= mwindow->theme->ccanvas_h ) + if( cx < 0 || cx >= canvas->view_w || + cy < 0 || cy >= canvas->view_h ) return 0; } diff --git a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C index 4a0f18f9..77ed39ea 100644 --- a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C +++ b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C @@ -460,6 +460,7 @@ void SketcherWindow::create_objects() void SketcherWindow::done_event(int result) { + ungrab(plugin->server->mwindow->cwindow->gui); } void SketcherWindow::send_configure_change() @@ -507,15 +508,16 @@ int SketcherWindow::do_grab_event(XEvent *event) CWindowGUI *cwindow_gui = mwindow->cwindow->gui; CWindowCanvas *canvas = cwindow_gui->canvas; int cx, cy; cwindow_gui->get_relative_cursor(cx, cy); - cx -= mwindow->theme->ccanvas_x; - cy -= mwindow->theme->ccanvas_y; + cx -= canvas->view_x; + cy -= canvas->view_y; if( !dragging ) { - if( cx < 0 || cx >= mwindow->theme->ccanvas_w || - cy < 0 || cy >= mwindow->theme->ccanvas_h ) + if( cx < 0 || cx >= canvas->view_w || + cy < 0 || cy >= canvas->view_h ) return 0; } + switch( event->type ) { case ButtonPress: if( dragging ) return 0; -- 2.26.2