mem leaks, fix canvas_h bug, diamond for bezier entpts, aging_plugin segv, grab bound...
authorGood Guy <good1.2guy@gmail.com>
Sat, 20 Apr 2019 19:39:25 +0000 (13:39 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sat, 20 Apr 2019 19:39:25 +0000 (13:39 -0600)
cinelerra-5.1/cinelerra/canvas.C
cinelerra-5.1/cinelerra/main.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/guicast/bcresources.C
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/bcwindowbase.h
cinelerra-5.1/leaker.C
cinelerra-5.1/plugins/aging/aging.C
cinelerra-5.1/plugins/crikey/crikeywindow.C
cinelerra-5.1/plugins/sketcher/sketcherwindow.C

index a01d1b9eabf3a11350f9c879cf59f9583df05116..d536cb1f21a3f5afbce4d32154225f1b39e989d6 100644 (file)
@@ -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)
index 6f4ee2e122cbaea6d1b3c83745bb2d4721a3ecc4..6833425d0b7d1d30aafc08c945f3e25fbb3475d1 100644 (file)
 #include <sys/resource.h>
 
 #ifdef LEAKER
-#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n)
+#if 0  // track allocators
+#include <execinfo.h>
+#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<nptrs; ) printf("%s ", trace[i++]);
+       printf("\n");
+        free(trace);
+}
+#define STRB ;leaker()
+#else
+#define STRB
+#endif
+#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n)STRB
 #define STRD(v) printf("==del %p from %p\n", v, __builtin_return_address(0))
 void *operator new(size_t n) { void *vp = malloc(n); STRC(vp); bzero(vp,n); return vp; }
 void operator delete(void *t) { STRD(t); free(t); }
index 748b8b2b8878ec25ba5a769709e7d3effd2d408f..52eab8b9e410068235ed347052389d289887e575 100644 (file)
@@ -2170,6 +2170,7 @@ int TrackCanvas::do_keyframes(int cursor_x,
                pankeyframe_pixmap,
                modekeyframe_pixmap,
                maskkeyframe_pixmap,
+               0,
        };
 
 
@@ -2468,12 +2469,23 @@ void TrackCanvas::draw_floatauto(FloatAuto *current,
        CLAMP(y1, ymin, ymax);
        CLAMP(y2, ymin, ymax);
 
-       if(y2 - 1 > 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<int> polygon_x;
+                       ArrayList<int> 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
index d44c435abe37fd74500b0867f87f9afb6eaf6734..16f53f97b0fad8476f6d04dd8d4861fea7cf54cb 100644 (file)
@@ -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;
index 583caac6d890e62de81dc16def9db3201a74e6a1..5d177c930d22693fe631a1a3727a6ee15bd1dcd0 100644 (file)
@@ -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;
 
index 7dfc26fd1ec4fb610f4bff928ec0e176e1993cb7..cd4dcd08bb766d5c5862531be2272fe074e47089 100644 (file)
@@ -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);
 
index 0098791279120775c0da1bc19dc8db8cae830c0a..209d6c68b6483d3084e6dc9fe6688cab7bf8b40d 100644 (file)
@@ -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) ) {
index 67a8023fbc96e9ad9bf0b1e3effc716114f80a9d..5517b44da14f800231db31ab0800b203a853bbd9 100644 (file)
@@ -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; \
                        } \
index 8d6d8644a86924179fffe5915cc7514212d0714f..a00c48c418af4c6589a1ea418b2d3ea0de85a04b 100644 (file)
@@ -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;
        }
 
index 4a0f18f9a439b5adc8294e478bfdbe0b78ae3943..77ed39ea6c4e94af38ce13dbd0151279614adee2 100644 (file)
@@ -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;