upgrade dmp output
[goodguy/history.git] / cinelerra-5.1 / cinelerra / mwindow.C
index a9e813af4131a8f9aaf61f1b23b190d3696ce967..de49bcf436aeead88135ae27e3e7b18bbc71e465 100644 (file)
 #include "transition.h"
 #include "transportque.h"
 #include "vframe.h"
+#include "versioninfo.h"
 #include "videodevice.inc"
 #include "videowindow.h"
 #include "vplayback.h"
@@ -213,6 +214,7 @@ MWindow::MWindow()
        restart_status = 0;
        screens = 1;
        in_destructor = 0;
+       warn_version = 1;
 }
 
 
@@ -235,6 +237,7 @@ MWindow::~MWindow()
        delete create_bd;       create_bd = 0;
        delete create_dvd;      create_dvd = 0;
        delete batch_render;    batch_render = 0;
+       delete render;          render = 0;
        commit_commercial();
        if( commercials && !commercials->remove_user() ) commercials = 0;
 
@@ -292,15 +295,13 @@ MWindow::~MWindow()
        finit_error();
        keyframe_threads->remove_all_objects();
        colormodels.remove_all_objects();
-       delete gui;             gui = 0;
-       delete render;          render = 0;
        delete awindow;         awindow = 0;
        delete lwindow;         lwindow = 0;
        delete twindow;         twindow = 0;
        delete wwindow;         wwindow = 0;
        delete gwindow;         gwindow = 0;
-       // must be last or nouveau chokes
        delete cwindow;         cwindow = 0;
+       delete gui;             gui = 0;
        //delete file_server;  file_server = 0; // reusable
        delete mainindexes;     mainindexes = 0;
        delete mainprogress;    mainprogress = 0;
@@ -340,8 +341,8 @@ MWindow::~MWindow()
 
 void MWindow::quit(int unlock)
 {
-       stop_playback(1);
        if(unlock) gui->unlock_window();
+       stop_playback(1);
 
        brender_lock->lock("MWindow::quit");
        delete brender;         brender = 0;
@@ -1500,7 +1501,29 @@ SET_TRACE
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
                                xml_file.read_from_file(filenames->get(i));
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
-
+                               const char *cin_version = 0;
+                               while( !xml_file.read_tag() ) {
+                                       if( xml_file.tag.title_is("EDL") ) {
+                                               cin_version = xml_file.tag.get_property("VERSION");
+                                               break;
+                                       }
+                               }
+                               xml_file.rewind();
+                               if( !cin_version ) {
+                                       eprintf(_("XML file %s\n not from cinelerra."),filenames->get(i));
+                                       char string[BCTEXTLEN];
+                                       sprintf(string,_("Unknown %s"), filenames->get(i));
+                                       gui->show_message(string);
+                                       result = 1;
+                                       break;
+                               }
+                               if( strcmp(cin_version, CINELERRA_VERSION) ) {
+                                       char string[BCTEXTLEN];
+                                       snprintf(string, sizeof(string),
+                                                _("Warning: XML from cinelerra version %s\n"
+                                               "Session data may be incompatible."), cin_version);
+                                       show_warning(&preferences->warn_version, string);
+                               }
                                if(load_mode == LOADMODE_NESTED)
                                {
 // Load temporary EDL for nesting.
@@ -2438,7 +2461,7 @@ void MWindow::hide_plugin(Plugin *plugin, int lock)
                        ptr->hide_gui();
                        delete_plugin(ptr);
 //sleep(1);
-//                     return;
+                       return;
                }
        }
        if(lock) plugin_gui_lock->unlock();
@@ -3123,13 +3146,23 @@ void MWindow::dump_exe(FILE *fp)
 {
         char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN];
         sprintf(proc_path, "/proc/%d/exe", (int)getpid());
-        int ret = readlink(proc_path, exe_path, sizeof(exe_path));
-       if( ret < 0 ) { fprintf(fp,"readlink: %m\n"); return; }
-       exe_path[ret] = 0;
+
+        int ret = -1, n = 100;
+       for( int len; (len=readlink(proc_path, exe_path, sizeof(exe_path)))>0; --n ) {
+               exe_path[len] = 0;  strcpy(proc_path, exe_path);
+               ret = 0;
+       }
+       if( n < 0 || ret < 0 ) { fprintf(fp,"readlink: %m\n"); return; }
+
        struct stat st;
-       if( stat(exe_path,&st) ) { fprintf(fp,"stat: %m\n"); return; }
-       fprintf(fp, "path: %s = %9jd bytes\n",exe_path,st.st_size);
-       int fd = open(exe_path,O_RDONLY+O_NONBLOCK);
+       if( stat(proc_path,&st) ) { fprintf(fp,"stat: %m\n"); return; }
+       fprintf(fp, "path: %s = %9jd bytes\n",proc_path,st.st_size);
+       struct tm *tm = localtime(&st.st_mtime);
+       char mtime[256];
+       strftime(mtime, sizeof(mtime), "%F %T", tm);
+       fprintf(fp,"mtime: %s\n", mtime);
+
+       int fd = open(proc_path,O_RDONLY+O_NONBLOCK);
        if( fd < 0 ) { fprintf(fp,"open: %m\n"); return; }
        uint8_t *bfr = 0;
        int64_t bfrsz = 0;