MWindow *mwindow = awindow->mwindow;
sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
mwindow->plugindb->remove(plugin);
- plugin->delete_this();
+ delete plugin; plugin = 0;
remove(plugin_path);
if( png_path[0] ) remove(png_path);
remove(index_path);
join();
#endif
reset_caches();
- delete_plugins();
dead_plugins->remove_all();
finit_error();
keyframe_threads->remove_all_objects();
delete assets; assets = 0;
delete splash_window; splash_window = 0;
delete theme; theme = 0;
+ delete_plugins();
delete channeldb_buz;
delete channeldb_v4l2jpeg;
// This must be last thread to exit
continue;
}
if( plugin_exists(plugin_path) ) continue;
- PluginServer *server = new PluginServer(mwindow, plugin_path, PLUGIN_TYPE_UNKNOWN);
- result = server->open_plugin(1, preferences, 0, 0);
+ PluginServer server(mwindow, plugin_path, PLUGIN_TYPE_UNKNOWN);
+ result = server.open_plugin(1, preferences, 0, 0);
if( !result ) {
- server->write_table(fp,vis_id);
- server->close_plugin();
- server->delete_this();
- continue;
+ server.write_table(fp,vis_id);
+ server.close_plugin();
}
- if( result != PLUGINSERVER_IS_LAD ) continue;
- int lad_index = 0;
- for(;;) {
- PluginServer *server = new PluginServer(mwindow, plugin_path, PLUGIN_TYPE_LADSPA);
- server->set_lad_index(lad_index++);
- result = server->open_plugin(1, preferences, 0, 0);
- if( result ) break;
- server->write_table(fp, PLUGIN_LADSPA_ID);
- server->close_plugin();
- server->delete_this();
+ else if( result == PLUGINSERVER_IS_LAD ) {
+ int lad_index = 0;
+ for(;;) {
+ PluginServer ladspa(mwindow, plugin_path, PLUGIN_TYPE_LADSPA);
+ ladspa.set_lad_index(lad_index++);
+ result = ladspa.open_plugin(1, preferences, 0, 0);
+ if( result ) break;
+ ladspa.write_table(fp, PLUGIN_LADSPA_ID);
+ ladspa.close_plugin();
+ }
}
}
}
exit(1);
}
- PluginServer plugin = *theme_plugin;
- if( plugin.open_plugin(0, preferences, 0, 0) ) {
+ PluginServer *plugin = new PluginServer(*theme_plugin);
+ if( plugin->open_plugin(0, preferences, 0, 0) ) {
fprintf(stderr, _("MWindow::init_theme: unable to load theme %s\n"),
theme_plugin->title);
exit(1);
}
- theme = plugin.new_theme();
+ theme = plugin->new_theme();
theme->mwindow = this;
- strcpy(theme->path, plugin.path);
- plugin.close_plugin();
+ strcpy(theme->path, plugin->path);
+ delete plugin;
// Load default images & settings
theme->Theme::initialize();
server->write_table(fp, PLUGIN_FFMPEG_ID);
server->close_plugin();
}
- server->delete_this();
+ delete server;
if( result ) fprintf(fp, "#%s\n", filter->name);
}
}
{
reset_parameters();
this->plugin_type = PLUGIN_TYPE_UNKNOWN;
+ plugin_obj = new PluginObj();
modules = new ArrayList<Module*>;
nodes = new ArrayList<VirtualNode*>;
}
{
reset_parameters();
plugin_type = that.plugin_type;
+ plugin_obj = that.plugin_obj;
+ plugin_obj->add_user();
title = !that.title ? 0 : cstrdup(that.title);
path = !that.path ? 0 : cstrdup(that.path);
ff_name = !that.ff_name ? 0 : cstrdup(that.ff_name);
delete modules;
delete nodes;
delete picon;
+ plugin_obj->remove_user();
}
// Done only once at creation
cleanup_plugin();
autos = 0;
edl = 0;
- dlobj = 0;
preferences = 0;
title = 0;
path = 0;
strcpy(string, ltitle);
}
-void *PluginServer::load_obj()
+void *PluginObj::load(const char *plugin_dir, const char *path)
{
- if( !dlobj ) {
- char dlpath[BCTEXTLEN], *dp = dlpath;
- char *cp = path;
- if( *cp != '/' ) {
- char *bp = preferences->plugin_dir;
- while( *bp ) *dp++ = *bp++;
- *dp++ = '/';
- }
- while( *cp ) *dp++ = *cp++;
- *dp = 0;
- dlobj = load(dlpath);
+ char dlpath[BCTEXTLEN], *dp = dlpath;
+ const char *cp = path;
+ if( *cp != '/' ) {
+ const char *bp = plugin_dir;
+ while( *bp ) *dp++ = *bp++;
+ *dp++ = '/';
}
- return dlobj;
+ while( *cp ) *dp++ = *cp++;
+ *dp = 0;
+ return dlobj = load(dlpath);
}
-void PluginServer::unload_obj()
+int PluginServer::load_obj()
{
- if( !dlobj ) return;
- unload(dlobj); dlobj = 0;
+ void *obj = plugin_obj->obj();
+ if( !obj ) obj =plugin_obj->load(preferences->plugin_dir, path);
+ return obj ? 1 : 0;
}
-void PluginServer::delete_this()
+const char *PluginServer::load_error()
{
- void *obj = dlobj;
- delete this;
- if( obj ) unload(obj);
+ return plugin_obj->load_error();
+}
+
+void *PluginServer::get_sym(const char *sym)
+{
+ if( !plugin_obj->obj() ) return 0;
+ return plugin_obj->load_sym(sym);
}
// Open plugin for signal processing
char string[BCTEXTLEN];
strcpy(string, load_error());
if( !strstr(string, "executable") ) {
- eprintf("PluginServer::open_plugin: load_obj failure = %s\n", string);
+ eprintf("PluginServer::open_plugin: load_obj %s = %s\n", path, string);
return PLUGINSERVER_NOT_RECOGNIZED;
}
plugin_type = PLUGIN_TYPE_EXECUTABLE;
}
if( plugin_type == PLUGIN_TYPE_UNKNOWN || plugin_type == PLUGIN_TYPE_BUILTIN ) {
new_plugin =
- (PluginClient* (*)(PluginServer*)) load_sym("new_plugin");
+ (PluginClient* (*)(PluginServer*)) get_sym("new_plugin");
if( new_plugin )
plugin_type = PLUGIN_TYPE_BUILTIN;
}
if( plugin_type == PLUGIN_TYPE_UNKNOWN || plugin_type == PLUGIN_TYPE_LADSPA ) {
lad_descriptor_function =
- (LADSPA_Descriptor_Function) load_sym("ladspa_descriptor");
+ (LADSPA_Descriptor_Function) get_sym("ladspa_descriptor");
if( lad_descriptor_function ) {
- if( lad_index < 0 ) {
- unload_obj();
- return PLUGINSERVER_IS_LAD;
- }
+ if( lad_index < 0 ) return PLUGINSERVER_IS_LAD;
lad_descriptor = lad_descriptor_function(lad_index);
if( !lad_descriptor )
return PLUGINSERVER_NOT_RECOGNIZED;
if( plugin_type == PLUGIN_TYPE_UNKNOWN ) {
fprintf(stderr, "PluginServer::open_plugin "
" %d: plugin undefined in %s\n", __LINE__, path);
- unload_obj();
return PLUGINSERVER_NOT_RECOGNIZED;
}
switch( plugin_type ) {
&plugin_type, path, title, &dir_idx, &audio, &video, &theme, &realtime,
&fileio, &uses_gui, &multichannel, &synthesis, &transition, &lad_index);
if( n != 14 ) return 1;
- this->path = cstrdup(path);
- this->title = cstrdup(title);
+ set_path(path);
+ set_title(title);
return 0;
}
#include "edl.inc"
#include "floatauto.inc"
#include "floatautos.inc"
+#include "garbage.h"
#include "keyframe.inc"
#include "ladspa.h"
#include "mainprogress.inc"
#include <dlfcn.h>
-class PluginServer
-{
- int reset_parameters();
- void init();
- int cleanup_plugin();
-
+class PluginObj : public Garbage {
void *dlobj;
+public:
+
void *load(const char *dlp) { return dlobj = dlopen(dlp, RTLD_NOW); }
+ void *load(const char *plugin_dir, const char *path);
void unload(void *obj) { dlclose(obj); }
void *load_sym(const char *sym) { return dlsym(dlobj, sym); }
const char *load_error() { return dlerror(); }
- void *load_obj();
- void unload_obj();
+ void *obj() { return dlobj; }
+
+ PluginObj() : Garbage("PluginObj:Garbage") { dlobj = 0; }
+ ~PluginObj() { if( dlobj ) unload(dlobj); }
+};
+
+class PluginServer
+{
+ PluginObj *plugin_obj;
+ int load_obj();
+ const char *load_error();
+ void *get_sym(const char *sym);
+
+ int reset_parameters();
+ void init();
+ int cleanup_plugin();
// Base class created by client
PluginClient *client;
EDL *edl, Plugin *plugin);
// close the plugin
int close_plugin();
- void delete_this();
char *get_plugin_png_path(char *png_path);
void dump(FILE *fp=stdout);
// Release any objects which are required after playback stops.
pane_color = BLACK;
drag_pane_color = WHITE;
-
-
-
+ appendasset_data = 0;
+ append_data = 0;
+ asset_append_data = 0;
+ asset_disk_data = 0;
+ asset_index_data = 0;
+ asset_info_data = 0;
+ asset_project_data = 0;
+ browse_data = 0;
+ calibrate_data = 0;
+ camerakeyframe_data = 0;
+ cancel_data = 0;
+ chain_data = 0;
+ channel_bg_data = 0;
+ channel_position_data = 0;
+ delete_all_indexes_data = 0;
+ deletebin_data = 0;
+ delete_data = 0;
+ deletedisk_data = 0;
+ deleteproject_data = 0;
+ detach_data = 0;
+ dntriangle_data = 0;
+
+ edit_data = 0;
+ edithandlein_data = 0;
+ edithandleout_data = 0;
+ extract_data = 0;
+ ffmpeg_toggle = 0;
+ infoasset_data = 0;
+ in_point = 0;
+ insert_data = 0;
+ keyframe_data = 0;
+ label_toggle = 0;
+ lift_data = 0;
+ maskkeyframe_data = 0;
+ modekeyframe_data = 0;
+ movedn_data = 0;
+ moveup_data = 0;
+ newbin_data = 0;
+ no_data = 0;
+ options_data = 0;
+ out_point = 0;
+ over_button = 0;
+ overwrite_data = 0;
+ pankeyframe_data = 0;
+ pasteasset_data = 0;
+ paused_data = 0;
+ picture_data = 0;
+ presentation_data = 0;
+ presentation_loop = 0;
+ presentation_stop = 0;
+ projectorkeyframe_data = 0;
+ redrawindex_data = 0;
+ renamebin_data = 0;
+ reset_data = 0;
+ reverse_data = 0;
+ rewind_data = 0;
+ select_data = 0;
+ shbtn_data = 0;
+ splice_data = 0;
+ start_over_data = 0;
+ statusbar_cancel_data = 0;
+ timebar_view_data = 0;
+ transition_data = 0;
+ uptriangle_data = 0;
+ viewasset_data = 0;
+ vtimebar_bg_data = 0;
}
frame_sizes.remove_all_objects();
sample_rates.remove_all_objects();
zoom_values.remove_all_objects();
+
delete about_bg;
}
command_lock->unlock();
next_command->unlock();
command->command_done->lock("BC_Synchronous::quit");
+ delete command;
}
long BC_Synchronous::send_command(BC_SynchronousCommand *command)
switch(command->command) {
case BC_SynchronousCommand::QUIT:
done = 1;
- break;
+ command->command_done->unlock();
+ return;
case BC_SynchronousCommand::DELETE_WINDOW:
delete_window_sync(command);
default:
handle_command(command);
- break;
+ command->command_done->unlock();
+ return;
}
-
- command->command_done->unlock();
+ delete command;
}
void BC_Synchronous::handle_command(BC_SynchronousCommand *command)
command->glx_context = window->glx_win_context;
send_garbage(command);
- command->command_done->lock("BC_Synchronous::delete_window");
#endif
}
delete pixmap;
#ifdef HAVE_GL
- if( get_resources()->get_synchronous() && top_level->options & GLX_WINDOW ) {
- if( !glx_win ) {
-// NVIDIA library threading problem, XCloseDisplay SEGVs without this
- sync_lock("BC_WindowBase::~BC_WindowBase:XDestroyWindow");
- lock_window("BC_WindowBase::~BC_WindowBase:XDestroyWindow");
- glXMakeContextCurrent(top_level->display, 0, 0, 0);
- XDestroyWindow(top_level->display, win);
- unlock_window();
- sync_unlock();
- }
- else
- get_resources()->get_synchronous()->delete_window(this);
- }
+ if( get_resources()->get_synchronous() &&
+ (top_level->options & GLX_WINDOW) && glx_win != 0 )
+ get_resources()->get_synchronous()->delete_window(this);
else
#endif
XDestroyWindow(top_level->display, win);
if(!(largefont_xft =
(resources.large_font_xft[0] == '-' ?
XftFontOpenXlfd(display, screen, resources.large_font_xft) :
- XftFontOpenXlfd(display, screen, resources.large_font_xft))) )
+ XftFontOpenName(display, screen, resources.large_font_xft))) )
if(!(largefont_xft =
XftFontOpenXlfd(display, screen, resources.large_font_xft2)))
largefont_xft = XftFontOpenXlfd(display, screen, "fixed");
BlondTheme::~BlondTheme()
{
+ delete camerakeyframe_data;
+ delete channel_bg_data;
+ delete channel_position_data;
+ delete keyframe_data;
+ delete maskkeyframe_data;
+ delete modekeyframe_data;
+ delete pankeyframe_data;
+ delete projectorkeyframe_data;
}
void BlondTheme::initialize()
BlueDotTheme::~BlueDotTheme()
{
+ delete camerakeyframe_data;
+ delete channel_bg_data;
delete channel_position_data;
delete keyframe_data;
- delete camerakeyframe_data;
delete maskkeyframe_data;
delete modekeyframe_data;
delete pankeyframe_data;
new_image("new_bg", "new_bg.png");
new_image("setformat_bg", "setformat_bg2.png");
-
- timebar_view_data = new_image("timebar_view.png");
-
// x, y of Format dialog box
setformat_w = 600;
setformat_h = 560;
BrightTheme::~BrightTheme()
{
+ delete camerakeyframe_data;
+ delete channel_position_data;
+ delete keyframe_data;
+ delete maskkeyframe_data;
+ delete modekeyframe_data;
+ delete pankeyframe_data;
+ delete projectorkeyframe_data;
}
void BrightTheme::initialize()
DefaultThemeMain::~DefaultThemeMain()
{
+ delete camerakeyframe_data;
+ delete channel_bg_data;
+ delete channel_position_data;
+ delete keyframe_data;
+ delete maskkeyframe_data;
+ delete modekeyframe_data;
+ delete pankeyframe_data;
+ delete projectorkeyframe_data;
}
char* DefaultThemeMain::plugin_title()
MicroThemeMain::~MicroThemeMain()
{
+ delete camerakeyframe_data;
+ delete channel_bg_data;
+ delete channel_position_data;
+ delete keyframe_data;
+ delete maskkeyframe_data;
+ delete modekeyframe_data;
+ delete pankeyframe_data;
+ delete projectorkeyframe_data;
}
SUV::~SUV()
{
+ delete camerakeyframe_data;
delete channel_position_data;
delete keyframe_data;
- delete camerakeyframe_data;
delete maskkeyframe_data;
delete modekeyframe_data;
delete pankeyframe_data;
for(int j = 0; j < len; j++)
{
FT_ULong c = test_string[j];
- check_char_code_path(freetype_library,
- font_entry->path,
- c,
- (char *)new_path);
+// memory leaks here are fatal
+// check_char_code_path(freetype_library,
+// font_entry->path,
+// c,
+// (char *)new_path);
+ strcpy(new_path, font_entry->path);
if( !load_freetype_face(freetype_library,
freetype_face, new_path)) {
FT_Set_Pixel_Sizes(freetype_face, text_height, 0);