modify folder segv fix, opengl pbfr resource conflict fix
authorGood Guy <good1.2guy@gmail.com>
Fri, 31 Aug 2018 20:18:48 +0000 (14:18 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 31 Aug 2018 20:18:48 +0000 (14:18 -0600)
cinelerra-5.1/cinelerra/binfolder.C
cinelerra-5.1/cinelerra/binfolder.h
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/playback3d.C
cinelerra-5.1/guicast/bcsynchronous.C
cinelerra-5.1/guicast/bctexture.C
cinelerra-5.1/guicast/vframe3d.C

index 593bfdab1fe041b27ba15a9caf15a0b30de40421..84f9769999dc051c86679f8934401791da94b6dc 100644 (file)
@@ -1826,6 +1826,7 @@ ModifyFolderThread::ModifyFolderThread(AWindowGUI *agui)
 {
        this->agui = agui;
        original = 0;
+       modify_edl = 0;
        folder = 0;
 }
 
@@ -1839,7 +1840,8 @@ void ModifyFolderThread::start(BinFolder *folder, int x, int y, int w, int h)
 {
        close_window();
        this->original = folder;
-       agui->mwindow->edl->add_user();
+       this->modify_edl = agui->mwindow->edl;
+       this->modify_edl->add_user();
        this->folder = new BinFolder(*folder);
        this->wx = x;  this->wy = y;
        this->ww = w;  this->wh = h;
@@ -1872,7 +1874,7 @@ void ModifyFolderThread::handle_done_event(int result)
        }
        delete folder;  folder = 0;
        original = 0;
-       agui->mwindow->edl->remove_user();
+       modify_edl->remove_user();
 }
 
 void ModifyFolderThread::handle_close_event(int result)
index 5bf0a55fc19acc5219501cd8c8221617ef6c559e..97b1335555b744d17f718e419a36e7c444eeaa3c 100644 (file)
@@ -26,6 +26,7 @@
 #include "awindowgui.inc"
 #include "binfolder.inc"
 #include "datatype.h"
+#include "edl.inc"
 #include "filesystem.h"
 #include "guicast.h"
 #include "indexable.h"
@@ -599,6 +600,7 @@ public:
        AWindowGUI *agui;
        BinFolder *original, *folder;
        ModifyFolderGUI *window;
+       EDL *modify_edl;
 };
 
 
index 2f0d6e20a78bed8b53f780f8d4788f6f2c53cbb0..154f929ae01e7964286043748126174a792059e8 100644 (file)
@@ -410,7 +410,7 @@ void EDL::copy_session(EDL *edl, int session_only)
                session->copy(edl->session);
        }
 
-       if( !session_only ) {
+       if( session_only <= 0 ) {
                local_session->copy_from(edl->local_session);
        }
 }
index f4a850b9838f4ba743cf8f831044eb851e9a0dd5..e57f66577565aeae63406160bff9f34fdabd61ba 100644 (file)
@@ -1839,7 +1839,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
                char string[BCTEXTLEN];
 
                new_edl->create_objects();
-               new_edl->copy_session(edl);
+               new_edl->copy_session(edl, -1);
                new_file->set_program(edl->session->program_no);
 
                sprintf(string, _("Loading %s"), new_asset->path);
index 6d6dee358b5bc18e72fae98e0ed45ce3b131cf59..ba21998ccdc37675aab25a20b905e34cf42a35bd 100644 (file)
@@ -960,19 +960,6 @@ void Playback3D::overlay_sync(Playback3DCommand *command)
                glColor4f(1, 1, 1, 1);
                glDisable(GL_BLEND);
 
-               if(command->frame) {
-// Render to PBuffer
-                       command->frame->enable_opengl();
-                       command->frame->set_opengl_state(VFrame::SCREEN);
-                       canvas_w = command->frame->get_w();
-                       canvas_h = command->frame->get_h();
-               }
-               else {
-// Render to canvas
-                       canvas_w = window->get_w();
-                       canvas_h = window->get_h();
-               }
-
 
 //printf("Playback3D::overlay_sync 1 %d\n", command->input->get_opengl_state());
                switch( command->input->get_opengl_state() ) {
@@ -987,16 +974,26 @@ void Playback3D::overlay_sync(Playback3DCommand *command)
                case VFrame::SCREEN:
                        command->input->enable_opengl();
                        command->input->screen_to_texture();
-                       if(command->frame)
-                               command->frame->enable_opengl();
-                       else
-                               window->enable_opengl();
                        break;
                default:
                        printf("Playback3D::overlay_sync unknown state\n");
                        break;
                }
 
+               if(command->frame) {
+// Render to PBuffer
+                       command->frame->enable_opengl();
+                       command->frame->set_opengl_state(VFrame::SCREEN);
+                       canvas_w = command->frame->get_w();
+                       canvas_h = command->frame->get_h();
+               }
+               else {
+// Render to canvas
+                       window->enable_opengl();
+                       canvas_w = window->get_w();
+                       canvas_h = window->get_h();
+               }
+
 
                const char *shader_stack[16];
                memset(shader_stack,0, sizeof(shader_stack));
index 3c0e601df008fe5cbe5cbc78d1448426ce6315a0..0bc4f104c3efb543381e7f79952895c6e0c3a55d 100644 (file)
@@ -512,7 +512,8 @@ void BC_Synchronous::release_pbuffer(int window_id, GLXPbuffer pbuffer)
        table_lock->lock("BC_Resources::release_textures");
        for(int i = 0; i < pbuffer_ids.total; i++) {
                PBufferID *ptr = pbuffer_ids.values[i];
-               if( ptr->window_id == window_id ) {
+               if( ptr->window_id == window_id &&
+                   ptr->glx_pbuffer == pbuffer ) {
                        ptr->in_use = 0;
                }
        }
index b527b4e137327ab853a7528958907338d30b56d2..59e21810d50ba64ffd07c23ebb4ca240592b4d11 100644 (file)
@@ -33,7 +33,6 @@ BC_Texture::BC_Texture(int w, int h, int colormodel)
        this->h = h;
        this->colormodel = colormodel;
        texture_id = -1;
-       texture_id = -1;
        texture_w = 0;
        texture_h = 0;
        texture_components = 0;
@@ -247,11 +246,14 @@ void BC_Texture::write_tex(const char *fn)
 #ifdef HAVE_GL
        int prev_id = -1;
        glGetIntegerv(GL_ACTIVE_TEXTURE, &prev_id);
-       glActiveTexture(this->texture_id);
+       glActiveTexture(GL_TEXTURE31);
+       glBindTexture(GL_TEXTURE_2D, texture_id);
+       glEnable(GL_TEXTURE_2D);
        int w = get_texture_w(), h = get_texture_h();
-       uint8_t img[w*h*3];
+       uint8_t *img = new uint8_t[w*h*3];
        glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, img);
        write_ppm(img, w, h, "%s", fn);
+       delete img;
        glActiveTexture(prev_id);
 #endif
 }
index 65eb1f3e92ff6a5def475444ac0b9eec810b859a..65d9d5ce7485e29b0c0b996cc0bc1093331e3d6a 100644 (file)
@@ -151,8 +151,8 @@ void VFrame::to_texture()
 
 void VFrame::create_pbuffer()
 {
-       if(pbuffer &&
-               pbuffer->window_id != BC_WindowBase::get_synchronous()->current_window->get_id())
+       if( pbuffer && (pbuffer->w != get_w() || pbuffer->h != get_h() ||
+               pbuffer->window_id != BC_WindowBase::get_synchronous()->current_window->get_id() ) )
        {
                delete pbuffer;
                pbuffer = 0;