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 a01d1b9..d536cb1 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 6f4ee2e..6833425 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 748b8b2..52eab8b 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 d44c435..16f53f9 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 583caac..5d177c9 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 7dfc26f..cd4dcd0 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 0098791..209d6c6 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 67a8023..5517b44 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 8d6d864..a00c48c 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 4a0f18f..77ed39e 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;