X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginclient.C;h=0e0637b734036cdf06c47459f60b524b8cc1d9c8;hb=5249bc8407920effc00e13940d3d4ccea0dd5d9f;hp=c401ef22dd19634f00196342d573505251256491;hpb=50a589b1decdd353a984d8a710e064ebaf8b4f7b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/pluginclient.C b/cinelerra-5.1/cinelerra/pluginclient.C index c401ef22..0e0637b7 100644 --- a/cinelerra-5.1/cinelerra/pluginclient.C +++ b/cinelerra-5.1/cinelerra/pluginclient.C @@ -26,6 +26,7 @@ #include "condition.h" #include "edl.h" #include "edlsession.h" +#include "file.h" #include "filesystem.h" #include "language.h" #include "localsession.h" @@ -55,8 +56,9 @@ PluginClientThread::PluginClientThread(PluginClient *client) PluginClientThread::~PluginClientThread() { -//printf("PluginClientThread::~PluginClientThread %p %d\n", this, __LINE__); join(); +//printf("PluginClientThread::~PluginClientThread %p %d\n", this, __LINE__); + delete window; window = 0; //printf("PluginClientThread::~PluginClientThread %p %d\n", this, __LINE__); delete init_complete; } @@ -67,10 +69,10 @@ void PluginClientThread::run() int result = 0; if(client->window_x < 0) client->window_x = info.get_abs_cursor_x(); if(client->window_y < 0) client->window_y = info.get_abs_cursor_y(); - window = client->new_window(); + if(!window) + window = client->new_window(); - if(window) - { + if(window) { window->lock_window("PluginClientThread::run"); window->create_objects(); window->unlock_window(); @@ -84,7 +86,6 @@ void PluginClientThread::run() //printf("PluginClientThread::run %p %d\n", this, __LINE__); window->hide_window(1); window->unlock_window(); - delete window; window = 0; // Can't save defaults in the destructor because it's not called immediately // after closing. /* if(client->defaults) */ client->save_defaults_xml(); @@ -592,23 +593,21 @@ void PluginClient::save_defaults_xml() using_defaults = 1; KeyFrame temp_keyframe; - save_data(&temp_keyframe); - FILE *fd = fopen(path, "w"); - if(fd) - { - fprintf(fd, "%d\n%d\n", window_x, window_y); - if(!fwrite(temp_keyframe.get_data(), strlen(temp_keyframe.get_data()), 1, fd)) - { + + const char *data = temp_keyframe.get_data(); + int len = strlen(data); + FILE *fp = fopen(path, "w"); + + if( fp ) { + fprintf(fp, "%d\n%d\n", window_x, window_y); + if( len > 0 && !fwrite(data, len, 1, fp) ) { fprintf(stderr, "PluginClient::save_defaults_xml %d \"%s\" %d bytes: %s\n", - __LINE__, - path, - (int)strlen(temp_keyframe.get_data()), - strerror(errno)); + __LINE__, path, len, strerror(errno)); } - - fclose(fd); + fclose(fp); } + using_defaults = 0; } @@ -660,12 +659,6 @@ int PluginClient::get_gui_status() return server->get_gui_status(); } -int PluginClient::start_plugin() -{ - printf(_("No processing defined for this plugin.\n")); - return 0; -} - // close event from client side void PluginClient::client_side_close() { @@ -816,7 +809,7 @@ int PluginClient::get_project_smp() const char* PluginClient::get_defaultdir() { - return BCASTDIR; + return File::get_plugin_path(); }