diff -u base/guicast/bcclipboard.C hvirtual-1.1.5/guicast/bcclipboard.C
--- base/guicast/bcclipboard.C	2003-05-01 15:11:31.000000000 +0200
+++ hvirtual-1.1.5/guicast/bcclipboard.C	2003-05-01 21:00:40.000000000 +0200
@@ -2,7 +2,7 @@
 #include "bcwindowbase.h"
 #include <string.h>
 
-BC_Clipboard::BC_Clipboard(char *display_name) : Thread()
+BC_Clipboard::BC_Clipboard(char *display_name) : Thread("Clipboard")
 {
 	Thread::set_synchronous(1);
 
diff -u base/guicast/bcfilebox.C hvirtual-1.1.5/guicast/bcfilebox.C
--- base/guicast/bcfilebox.C	2003-05-01 15:11:30.000000000 +0200
+++ hvirtual-1.1.5/guicast/bcfilebox.C	2003-05-01 21:01:31.000000000 +0200
@@ -50,7 +50,7 @@
 }
 
 
-BC_NewFolderThread::BC_NewFolderThread(BC_FileBox *filebox)
+BC_NewFolderThread::BC_NewFolderThread(BC_FileBox *filebox) : Thread("New folder")
 {
 	this->filebox = filebox;
 	active = 0;
diff -u base/guicast/bcprogressbox.C hvirtual-1.1.5/guicast/bcprogressbox.C
--- base/guicast/bcprogressbox.C	2003-05-01 15:11:30.000000000 +0200
+++ hvirtual-1.1.5/guicast/bcprogressbox.C	2003-05-01 21:01:50.000000000 +0200
@@ -5,7 +5,7 @@
 #include "bcwindow.h"
 
 BC_ProgressBox::BC_ProgressBox(int x, int y, char *text, long length)
- : Thread()
+ : Thread("Progressbox")
 {
 	set_synchronous(1);
 	pwindow = new BC_ProgressWindow(x, y);
diff -u base/guicast/bcrepeater.C hvirtual-1.1.5/guicast/bcrepeater.C
--- base/guicast/bcrepeater.C	2003-05-01 15:11:30.000000000 +0200
+++ hvirtual-1.1.5/guicast/bcrepeater.C	2003-05-01 21:02:17.000000000 +0200
@@ -2,7 +2,7 @@
 #include "bcwindow.h"
 
 BC_Repeater::BC_Repeater(BC_WindowBase *top_level, long delay)
- : Thread()
+ : Thread("Repeater")
 {
 	set_synchronous(1);
 	repeating = 0;
diff -u base/guicast/bcwindowbase.C hvirtual-1.1.5/guicast/bcwindowbase.C
--- base/guicast/bcwindowbase.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/guicast/bcwindowbase.C	2003-05-02 19:20:04.000000000 +0200
@@ -115,11 +115,15 @@
 BC_WindowBase::BC_WindowBase()
 {
 //printf("BC_WindowBase::BC_WindowBase 1\n");
+	destructed = 0;
 	BC_WindowBase::initialize();
 }
 
 BC_WindowBase::~BC_WindowBase()
 {
+	if (destructed)
+		printf("Error: double destruction\n");
+	destructed = 1;
 //printf("BC_WindowBase::~BC_WindowBase 1 %s\n", title);
 
 #ifdef HAVE_LIBXXF86VM
@@ -140,10 +144,7 @@
 
 	if(subwindows)
 	{
-		for(int i = 0; i < subwindows->total; i++)
-		{
-			delete subwindows->values[i];
-		}
+		subwindows->remove_all_objects();
 		delete subwindows;
 	}
 
@@ -152,8 +153,9 @@
 
 	if(bg_pixmap && !shared_bg_pixmap) delete bg_pixmap;
 	if(icon_pixmap) delete icon_pixmap;
-	if(icon_window) delete icon_window;
-
+	
+	if (temp_bitmap) delete temp_bitmap;
+	
 	if(window_type == MAIN_WINDOW) 
 	{
 		
@@ -206,8 +208,8 @@
 	current_color = BLACK;
 	is_dragging = 0;
 	shared_bg_pixmap = 0;
-	icon_pixmap = 0;
 	icon_window = 0;
+	icon_pixmap = 0;
 	window_type = MAIN_WINDOW;
 	translation_count = 0;
 	x_correction = y_correction = 0;
@@ -253,8 +255,6 @@
     int vm;
 #endif
 
-    if(parent_window) top_level = parent_window->top_level;
-
 #ifdef HAVE_LIBXXF86VM
     if(window_type == VIDMODE_SCALED_WINDOW)
 	    closest_vm(&vm,&w,&h);
@@ -1560,10 +1560,10 @@
 
 int BC_WindowBase::init_fonts()
 {
+
 	if (largefont == NULL) 
 	if((largefont = XLoadQueryFont(display, resources.large_font)) == NULL) 
-		largefont = XLoadQueryFont(display, "fixed"); 
-
+			largefont = XLoadQueryFont(display, "fixed"); 
 	if (mediumfont == NULL) 
 	if((mediumfont = XLoadQueryFont(display, resources.medium_font)) == NULL)
 		mediumfont = XLoadQueryFont(display, "fixed"); 
@@ -2900,14 +2900,14 @@
 		1);
 
 	if(icon_window) delete icon_window;
-	icon_window = new BC_Popup(this, 
+	add_subwindow (icon_window = new BC_Popup(this, 
 		(int)BC_INFINITY, 
 		(int)BC_INFINITY, 
 		icon_pixmap->get_w(), 
 		icon_pixmap->get_h(), 
 		-1, 
 		1, // All windows are hidden initially
-		icon_pixmap);
+		icon_pixmap));
 
 	XWMHints wm_hints;
 	wm_hints.flags = IconPixmapHint | IconMaskHint | IconWindowHint;
diff -u base/guicast/bcwindowbase.h hvirtual-1.1.5/guicast/bcwindowbase.h
--- base/guicast/bcwindowbase.h	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/guicast/bcwindowbase.h	2003-05-02 18:11:33.000000000 +0200
@@ -431,7 +431,7 @@
    void restore_vm();
 #endif
 
-	
+	int destructed;		//  if object is destructed =1	
 
 
 private:
diff -u base/guicast/rotateframe.C hvirtual-1.1.5/guicast/rotateframe.C
--- base/guicast/rotateframe.C	2003-05-01 15:11:29.000000000 +0200
+++ hvirtual-1.1.5/guicast/rotateframe.C	2003-05-01 21:02:34.000000000 +0200
@@ -357,7 +357,7 @@
 
 
 
-RotateEngine::RotateEngine(RotateFrame *plugin, int row1, int row2) : Thread()
+RotateEngine::RotateEngine(RotateFrame *plugin, int row1, int row2) : Thread("RotateEngine")
 {
 	this->plugin = plugin;
 	Thread::set_synchronous(1);
diff -u base/guicast/thread.C hvirtual-1.1.5/guicast/thread.C
--- base/guicast/thread.C	2003-05-01 15:11:31.000000000 +0200
+++ hvirtual-1.1.5/guicast/thread.C	2003-05-02 19:18:46.000000000 +0200
@@ -2,11 +2,13 @@
 #include <signal.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <string.h>
 #include "thread.h"
 
-
-Thread::Thread(int synchronous, int realtime, int autodelete)
+Thread::Thread(char *thread_name, int synchronous, int realtime, int autodelete)
 {
+	strncpy(this->thread_name,thread_name,99);
+//	printf("Thread constructor: %s\n",this->thread_name);
 	this->synchronous = synchronous;
 	this->realtime = realtime;
 	this->autodelete = autodelete;
@@ -77,7 +79,9 @@
 int Thread::join()   // join this thread
 {
 	int result = 0;
+//	printf("Joining thread: %s\n", thread_name);
 	if(tid > 0) result = pthread_join(tid, 0); 
+//	printf("Thread joined: %s\n", thread_name);
 
 	tid = (pthread_t)-1;
 
diff -u base/guicast/thread.h hvirtual-1.1.5/guicast/thread.h
--- base/guicast/thread.h	2003-05-01 15:11:31.000000000 +0200
+++ hvirtual-1.1.5/guicast/thread.h	2003-05-01 23:15:09.000000000 +0200
@@ -16,7 +16,7 @@
 protected:
 	virtual void run() = 0;
 public:
-	Thread(int synchronous = 0, int realtime = 0, int autodelete = 0);
+	Thread(char *thread_name,int synchronous = 0, int realtime = 0, int autodelete = 0);
 	virtual ~Thread();
 	void start();
 	int end(pthread_t tid);           // end another thread
@@ -36,7 +36,7 @@
 	static int calculate_realtime();    // Determine status by querying kernel
 	int get_synchronous();
 	int get_tid();
-
+	char thread_name[100];
 private:
 	int synchronous;         // set to 1 to force join() to end
 	int realtime;            // set to 1 to schedule realtime
diff -u base/cinelerra/assetedit.C hvirtual-1.1.5/cinelerra/assetedit.C
--- base/cinelerra/assetedit.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/assetedit.C	2003-05-01 21:03:50.000000000 +0200
@@ -19,7 +19,7 @@
 #include <string.h>
 
 AssetEdit::AssetEdit(MWindow *mwindow)
- : Thread()
+ : Thread("AssetEdit")
 {
 	this->mwindow = mwindow;
 	asset = 0;
diff -u base/cinelerra/assetremove.C hvirtual-1.1.5/cinelerra/assetremove.C
--- base/cinelerra/assetremove.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/assetremove.C	2003-05-01 21:04:11.000000000 +0200
@@ -28,7 +28,7 @@
 
 
 AssetRemoveThread::AssetRemoveThread(MWindow *mwindow)
- : Thread()
+ : Thread("AssetRemove")
 {
 	this->mwindow = mwindow;
 	Thread::set_synchronous(0);
diff -u base/cinelerra/audiodevice.C hvirtual-1.1.5/cinelerra/audiodevice.C
--- base/cinelerra/audiodevice.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/audiodevice.C	2003-05-01 21:04:37.000000000 +0200
@@ -27,7 +27,7 @@
 
 
 AudioDevice::AudioDevice()
- : Thread()
+ : Thread("Audiodevice")
 {
 	initialize();
 	this->out_config = new AudioOutConfig(0, 0, 0);
diff -u base/cinelerra/audiooss.C hvirtual-1.1.5/cinelerra/audiooss.C
--- base/cinelerra/audiooss.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/audiooss.C	2003-05-01 21:05:10.000000000 +0200
@@ -22,7 +22,7 @@
 // Synchronie multiple devices by using threads
 
 OSSThread::OSSThread(AudioOSS *device)
- : Thread()
+ : Thread("AudioOSS")
 {
 	set_synchronous(1);
 	rd = 0;
diff -u base/cinelerra/awindow.C hvirtual-1.1.5/cinelerra/awindow.C
--- base/cinelerra/awindow.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/awindow.C	2003-05-01 21:05:35.000000000 +0200
@@ -4,7 +4,7 @@
 #include "awindowgui.h"
 #include "clipedit.h"
 
-AWindow::AWindow(MWindow *mwindow) : Thread(1)     // don't detach so we can join
+AWindow::AWindow(MWindow *mwindow) : Thread("AWindow", 1)     // don't detach so we can join
 {
 	this->mwindow = mwindow;
 	current_folder[0] = 0;
diff -u base/cinelerra/awindowgui.C hvirtual-1.1.5/cinelerra/awindowgui.C
--- base/cinelerra/awindowgui.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/awindowgui.C	2003-05-02 17:11:42.000000000 +0200
@@ -246,10 +246,13 @@
 	vtransitions.remove_all_objects();
 	displayed_assets[1].remove_all_objects();
 	delete file_icon;
+	delete folder_icon;
 	delete audio_icon;
 	delete video_icon;
-	delete folder_icon;
 	delete clip_icon;
+	delete asset_list;
+	delete divider;
+	delete folder_list;
 	delete newfolder_thread;
 	delete asset_menu;
 	delete assetlist_menu;
@@ -1274,7 +1277,7 @@
 }
 
 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
- : BC_Button(x, y, mwindow->theme->appendasset_data)
+ : BC_Button(x, y, mwindow->theme->appendasset_data) // FIXME appendasset_data not initialized in defaulttheme
 {
 	this->mwindow = mwindow;
 	this->gui = gui;
Common subdirectories: base/cinelerra/Blond and hvirtual-1.1.5/cinelerra/Blond
diff -u base/cinelerra/brender.C hvirtual-1.1.5/cinelerra/brender.C
--- base/cinelerra/brender.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/brender.C	2003-05-01 22:05:52.000000000 +0200
@@ -32,7 +32,7 @@
 
 
 BRender::BRender(MWindow *mwindow)
- : Thread()
+ : Thread("BRender")
 {
 	this->mwindow = mwindow;
 	map_lock = new Mutex;
@@ -338,7 +338,7 @@
 
 
 BRenderThread::BRenderThread(MWindow *mwindow, BRender *brender)
- : Thread(1)
+ : Thread("BRenderThread", 1)
 {
 	this->mwindow = mwindow;
 	this->brender = brender;
diff -u base/cinelerra/browsebutton.C hvirtual-1.1.5/cinelerra/browsebutton.C
--- base/cinelerra/browsebutton.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/browsebutton.C	2003-05-01 21:06:03.000000000 +0200
@@ -11,7 +11,7 @@
 	char *title, 
 	char *caption, 
 	int want_directory)
- : BC_Button(x, y, mwindow->theme->magnify_button_data), Thread()
+ : BC_Button(x, y, mwindow->theme->magnify_button_data), Thread("BrowseButton")
 {
 	this->parent_window = parent_window;
 	this->want_directory = want_directory;
diff -u base/cinelerra/canvas.C hvirtual-1.1.5/cinelerra/canvas.C
--- base/cinelerra/canvas.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/canvas.C	2003-05-02 00:10:14.000000000 +0200
@@ -29,12 +29,15 @@
 	this->use_cwindow = use_cwindow;
 	this->use_rwindow = use_rwindow;
 	this->use_vwindow = use_vwindow;
+	canvas = 0;
+	canvas_menu = 0;
 }
 
 Canvas::~Canvas()
 {
 	if(refresh_frame) delete refresh_frame;
 	delete canvas_menu;
+	delete canvas;
 }
 
 void Canvas::reset()
diff -u base/cinelerra/channeledit.C hvirtual-1.1.5/cinelerra/channeledit.C
--- base/cinelerra/channeledit.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/channeledit.C	2003-05-01 21:06:51.000000000 +0200
@@ -15,7 +15,7 @@
 	ChannelPicker *channel_picker,
 	ArrayList<Channel*> *channeldb,
 	Record *record)
- : Thread()
+ : Thread("ChannelEdit")
 {
 	this->channel_picker = channel_picker;
 	this->mwindow = mwindow;
@@ -444,7 +444,7 @@
 ChannelEditEditThread::ChannelEditEditThread(ChannelEditWindow *window, 
 	ChannelPicker *channel_picker,
 	Record *record)
- : Thread()
+ : Thread("ChannelEditEdit")
 {
 	this->window = window;
 	this->channel_picker = channel_picker;
@@ -877,7 +877,7 @@
 // ========================== picture quality
 
 ChannelEditPictureThread::ChannelEditPictureThread(ChannelPicker *channel_picker, ChannelEditWindow *window)
- : Thread()
+ : Thread("ChannelEditPicture")
 {
 	this->channel_picker = channel_picker;
 	this->window = window;
diff -u base/cinelerra/clipedit.C hvirtual-1.1.5/cinelerra/clipedit.C
--- base/cinelerra/clipedit.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/clipedit.C	2003-05-01 21:07:12.000000000 +0200
@@ -14,7 +14,7 @@
 
 
 ClipEdit::ClipEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow)
- : Thread()
+ : Thread("ClipEdit")
 {
 	this->mwindow = mwindow;
 	this->awindow = awindow;
diff -u base/cinelerra/commonrender.C hvirtual-1.1.5/cinelerra/commonrender.C
--- base/cinelerra/commonrender.C	2003-05-02 19:16:35.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/commonrender.C	2003-05-01 21:07:57.000000000 +0200
@@ -19,7 +19,7 @@
 #include "virtualconsole.h"
 
 CommonRender::CommonRender(RenderEngine *renderengine)
- : Thread()
+ : Thread("CommonRender")
 {
 	this->renderengine = renderengine;
 	reset_parameters();
@@ -297,7 +297,7 @@
 
 
 CommonRender::CommonRender(MWindow *mwindow, RenderEngine *renderengine)
- : Thread()
+ : Thread("CommonRender")
 {
 	this->mwindow = mwindow;
 	this->renderengine = renderengine;
diff -u base/cinelerra/cwindow.C hvirtual-1.1.5/cinelerra/cwindow.C
--- base/cinelerra/cwindow.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/cwindow.C	2003-05-01 21:08:52.000000000 +0200
@@ -25,7 +25,7 @@
 
 
 CWindow::CWindow(MWindow *mwindow)
- : Thread(1)			// don't detach, so we can join...
+ : Thread("CWindow", 1)			// don't detach, so we can join...
 {
 	this->mwindow = mwindow;
 }
diff -u base/cinelerra/cwindowtool.C hvirtual-1.1.5/cinelerra/cwindowtool.C
--- base/cinelerra/cwindowtool.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/cwindowtool.C	2003-05-02 18:30:05.000000000 +0200
@@ -23,7 +23,7 @@
 #include "transportque.h"
 
 CWindowTool::CWindowTool(MWindow *mwindow, CWindowGUI *gui)
- : Thread()
+ : Thread("CWindowTool")
 {
 	this->mwindow = mwindow;
 	this->gui = gui;
@@ -1470,6 +1470,18 @@
 }
 CWindowMaskGUI::~CWindowMaskGUI()
 {
+	delete mode;
+	delete title_1;
+	delete title_2;	
+	delete value;
+	delete delete_point;
+	delete title_3;
+	delete title_4;
+	delete title_5;
+	delete title_6;
+	delete x;
+	delete y;
+	
 	delete number;
 	delete feather;
 }
@@ -1484,17 +1496,16 @@
 		keyframe = (MaskAuto*)mwindow->cwindow->calculate_affected_auto(track->automation->mask_autos, 0);
 //printf("CWindowMaskGUI::create_objects 1\n");
 
-	BC_Title *title;
-	add_subwindow(title = new BC_Title(x, y, "Mode:"));
+	add_subwindow(title_1 = new BC_Title(x, y, "Mode:"));
 	add_subwindow(mode = new CWindowMaskMode(mwindow, 
 		this, 
-		x + title->get_w(), 
+		x + title_1->get_w(), 
 		y,
 		""));
 //printf("CWindowMaskGUI::create_objects 1\n");
 	mode->create_objects();
 	y += 40;
-	add_subwindow(new BC_Title(x, y, "Value:"));
+	add_subwindow(title_2 = new BC_Title(x, y, "Value:"));
 	add_subwindow(value = new CWindowMaskValue(mwindow, this, x + 50, y));
 	y += 30;
 	add_subwindow(delete_point = new CWindowMaskDelete(mwindow, this, x, y));
@@ -1503,7 +1514,7 @@
 //	y += 30;
 //	add_subwindow(prev_point = new CWindowMaskCyclePrev(mwindow, this, x, y));
 //	y += 40;
-	add_subwindow(new BC_Title(x, y, "Mask number:"));
+	add_subwindow(title_3 = new BC_Title(x, y, "Mask number:"));
 	number = new CWindowMaskNumber(mwindow, 
 		this, 
 		x + 110, 
@@ -1511,23 +1522,23 @@
 //printf("CWindowMaskGUI::create_objects 1\n");
 	number->create_objects();
 	y += 30;
-	add_subwindow(new BC_Title(x, y, "Feather:"));
+	add_subwindow(title_4 = new BC_Title(x, y, "Feather:"));
 	feather = new CWindowMaskFeather(mwindow,
 		this,
 		x + 110,
 		y);
 	feather->create_objects();
 	y += 30;
-	add_subwindow(title = new BC_Title(x, y, "X:"));
-	x += title->get_w();
+	add_subwindow(title_5 = new BC_Title(x, y, "X:"));
+	x += title_5->get_w();
 	this->x = new CWindowCoord(this, 
 		x, 
 		y, 
 		(float)0.0);
 	this->x->create_objects();
 	x += 150;
-	add_subwindow(title = new BC_Title(x, y, "Y:"));
-	x += title->get_w();
+	add_subwindow(title_6 = new BC_Title(x, y, "Y:"));
+	x += title_6->get_w();
 	this->y = new CWindowCoord(this, 
 		x, 
 		y, 
diff -u base/cinelerra/cwindowtool.h hvirtual-1.1.5/cinelerra/cwindowtool.h
--- base/cinelerra/cwindowtool.h	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/cwindowtool.h	2003-05-02 18:28:53.000000000 +0200
@@ -182,6 +182,7 @@
 
 	CWindowCoord *x, *y;
 	CWindowMaskMode *mode;
+	BC_Title *title_1, *title_2, *title_3, *title_4, *title_5, *title_6;
 	CWindowMaskFeather *feather;
 	CWindowMaskDelete *delete_point;
 // Not necessary if all keyframes have same points
Common subdirectories: base/cinelerra/data and hvirtual-1.1.5/cinelerra/data
diff -u base/cinelerra/dcoffset.C hvirtual-1.1.5/cinelerra/dcoffset.C
--- base/cinelerra/dcoffset.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/dcoffset.C	2003-05-01 21:10:17.000000000 +0200
@@ -6,7 +6,7 @@
 
 
 DC_Offset::DC_Offset()
- : Thread()
+ : Thread("DC_Offset")
 {
 	getting_dc_offset = 0;
 	for(int i = 0; i < MAXCHANNELS; i++) dc_offset[i] = 0;
Only in base/cinelerra/: DEADJOE
diff -u base/cinelerra/deleteallindexes.C hvirtual-1.1.5/cinelerra/deleteallindexes.C
--- base/cinelerra/deleteallindexes.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/deleteallindexes.C	2003-05-01 21:10:50.000000000 +0200
@@ -10,7 +10,7 @@
 
 
 DeleteAllIndexes::DeleteAllIndexes(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y)
- : BC_GenericButton(x, y, "Delete existing indexes"), Thread()
+ : BC_GenericButton(x, y, "Delete existing indexes"), Thread("DeleteAllIndexes")
 {
 	this->mwindow = mwindow;
 	this->pwindow = pwindow;
Common subdirectories: base/cinelerra/.deps and hvirtual-1.1.5/cinelerra/.deps
diff -u base/cinelerra/drivesync.C hvirtual-1.1.5/cinelerra/drivesync.C
--- base/cinelerra/drivesync.C	2003-05-01 15:10:50.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/drivesync.C	2003-05-01 21:11:03.000000000 +0200
@@ -4,7 +4,7 @@
 #include <unistd.h>
 
 DriveSync::DriveSync()
- : Thread()
+ : Thread("DriveSync")
 {
 	done = 0;
 	set_synchronous(1);
diff -u base/cinelerra/editpanel.C hvirtual-1.1.5/cinelerra/editpanel.C
--- base/cinelerra/editpanel.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/editpanel.C	2003-05-02 17:55:39.000000000 +0200
@@ -73,6 +73,7 @@
 
 EditPanel::~EditPanel()
 {
+	delete_buttons();
 }
 
 void EditPanel::set_meters(MeterPanel *meter_panel)
@@ -92,44 +93,47 @@
 
 void EditPanel::delete_buttons()
 {
-	if(use_editing_mode)
+	if (use_editing_mode)
 	{
-		if(arrow) delete arrow;
-		if(ibeam) delete ibeam;
+		if (arrow) delete arrow;
+		if (ibeam) delete ibeam;
 	}
 	
-	if(use_keyframe)
+	if (use_keyframe) 
 		delete keyframe;
 
-
-// 	if(editing_mode == EDITING_ARROW)
-// 	{
-		if(inpoint) delete inpoint;
-		if(outpoint) delete outpoint;
-//		delete delinpoint;
-//		delete deloutpoint;
-		if(use_copy) delete copy;
-		if(use_splice) delete splice;
-		if(use_overwrite) delete overwrite;
-//	FIX	if(use_lift) delete lift;
-//	FIX	if(use_extract) delete extract;
-// 	}
-// 	else
-// 	{
-		if(cut) delete cut;
-		if(copy) delete copy;
-		if(use_paste) delete paste;
-//	}
-
-	if(use_labels)
+	if (inpoint) 
+		delete inpoint;
+	if (outpoint) 
+		delete outpoint;
+
+	if (use_splice) 
+		delete splice;
+	if (use_overwrite) 
+		delete overwrite;
+//	if (use_lift)          // never used
+//		delete lift;
+//	if (use_extract)       // never used
+//		delete extract;
+	if (use_toclip)
+		delete clip;
+	if (use_cut) 
+		delete cut;
+	if (use_copy) 
+		delete copy;
+	if (use_paste) 
+		delete paste;
+	if (use_meters) 
+		delete meters;
+	if (use_labels)
 	{	
 		delete labelbutton;
 		delete prevlabel;
 		delete nextlabel;
 	}
-
-	if(use_fit) delete fit;
-	if(use_undo)
+	if (use_fit) 
+		delete fit;
+	if (use_undo)
 	{
 		delete undo;
 		delete redo;
diff -u base/cinelerra/filemov.C hvirtual-1.1.5/cinelerra/filemov.C
--- base/cinelerra/filemov.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/filemov.C	2003-05-01 21:11:55.000000000 +0200
@@ -990,7 +990,7 @@
 }
 
 
-FileMOVThread::FileMOVThread(FileMOV *filemov, int fields) : Thread()
+FileMOVThread::FileMOVThread(FileMOV *filemov, int fields) : Thread("FileMOV")
 {
 	this->filemov = filemov;
 	this->fields = fields;
diff -u base/cinelerra/filethread.C hvirtual-1.1.5/cinelerra/filethread.C
--- base/cinelerra/filethread.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/filethread.C	2003-05-01 21:12:49.000000000 +0200
@@ -5,7 +5,7 @@
 
 #include <unistd.h>
 
-FileThread::FileThread(File *file, int do_audio, int do_video) : Thread()
+FileThread::FileThread(File *file, int do_audio, int do_video) : Thread("FileThread")
 {
 	create_objects(file,
 		do_audio,
@@ -22,7 +22,7 @@
 		long buffer_size, 
 		int color_model, 
 		int ring_buffers, 
-		int compressed)
+		int compressed) : Thread("FileThread")
 {
 	create_objects(file, 
 		do_audio, 
diff -u base/cinelerra/formattools.C hvirtual-1.1.5/cinelerra/formattools.C
--- base/cinelerra/formattools.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/formattools.C	2003-05-01 21:13:17.000000000 +0200
@@ -251,7 +251,7 @@
 
 
 FormatAThread::FormatAThread(FormatTools *format)
- : Thread()
+ : Thread("FormatAThread")
 { 
 	this->format = format; 
 	file = new File;
@@ -275,7 +275,7 @@
 
 FormatVThread::FormatVThread(FormatTools *format, 
 	int lock_compressor)
- : Thread()
+ : Thread("FormatVThread")
 {
 	this->lock_compressor = lock_compressor;
 	this->format = format;
diff -u base/cinelerra/indexthread.C hvirtual-1.1.5/cinelerra/indexthread.C
--- base/cinelerra/indexthread.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/indexthread.C	2003-05-01 21:13:41.000000000 +0200
@@ -18,7 +18,7 @@
 						Asset *asset,
 						char *index_filename,
 						long buffer_size, 
-						long length_source)
+						long length_source) : Thread("IndexThread")
 {
 	this->asset = asset;
 	this->buffer_size = buffer_size;
diff -u base/cinelerra/levelwindow.C hvirtual-1.1.5/cinelerra/levelwindow.C
--- base/cinelerra/levelwindow.C	2003-05-01 15:10:50.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/levelwindow.C	2003-05-01 21:14:08.000000000 +0200
@@ -4,7 +4,7 @@
 #include "mwindow.h"
 
 LevelWindow::LevelWindow(MWindow *mwindow)
- : Thread()
+ : Thread("LevelWindow")
 {
 	this->mwindow = mwindow;
 	Thread::set_synchronous(1);
diff -u base/cinelerra/loadbalance.C hvirtual-1.1.5/cinelerra/loadbalance.C
--- base/cinelerra/loadbalance.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/loadbalance.C	2003-05-01 21:14:21.000000000 +0200
@@ -20,7 +20,7 @@
 
 
 LoadClient::LoadClient(LoadServer *server)
- : Thread()
+ : Thread("LoadClient")
 {
 	Thread::set_synchronous(1);
 	this->server = server;
diff -u base/cinelerra/loadfile.C hvirtual-1.1.5/cinelerra/loadfile.C
--- base/cinelerra/loadfile.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/loadfile.C	2003-05-01 21:16:17.000000000 +0200
@@ -54,7 +54,7 @@
 
 
 LoadFileThread::LoadFileThread(MWindow *mwindow, Load *load)
- : Thread()
+ : Thread("LoadFile")
 {
 	this->mwindow = mwindow;
 	this->load = load;
@@ -296,7 +296,7 @@
 
 
 LoadPrevious::LoadPrevious(MWindow *mwindow, Load *loadfile)
- : BC_MenuItem(""), Thread()
+ : BC_MenuItem(""), Thread("LoadPrevious")
 { 
 	this->mwindow = mwindow;
 	this->loadfile = loadfile; 
diff -u base/cinelerra/main.C hvirtual-1.1.5/cinelerra/main.C
--- base/cinelerra/main.C	2003-05-01 15:10:50.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/main.C	2003-05-01 15:28:55.000000000 +0200
@@ -142,6 +142,7 @@
 	}
 
 	filenames.remove_all_objects();
+	printf("Normal program termination\n");
 	return 0;
 }
 
diff -u base/cinelerra/mainindexes.C hvirtual-1.1.5/cinelerra/mainindexes.C
--- base/cinelerra/mainindexes.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/mainindexes.C	2003-05-01 21:16:40.000000000 +0200
@@ -13,7 +13,7 @@
 #include <string.h>
 
 MainIndexes::MainIndexes(MWindow *mwindow)
- : Thread()
+ : Thread("MainIndexes")
 {
 	this->mwindow = mwindow;
 	set_synchronous(1);
diff -u base/cinelerra/menueffects.C hvirtual-1.1.5/cinelerra/menueffects.C
--- base/cinelerra/menueffects.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/menueffects.C	2003-05-01 21:17:14.000000000 +0200
@@ -60,7 +60,7 @@
 
 
 
-MenuEffectThread::MenuEffectThread(MWindow *mwindow)
+MenuEffectThread::MenuEffectThread(MWindow *mwindow) : Thread("MenuEffects")
 {
 	this->mwindow = mwindow;
 	sprintf(title, "");
diff -u base/cinelerra/new.C hvirtual-1.1.5/cinelerra/new.C
--- base/cinelerra/new.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/new.C	2003-05-01 21:17:43.000000000 +0200
@@ -24,6 +24,12 @@
 {
 	this->mwindow = mwindow;
 	script = 0;
+	thread = 0;
+}
+
+New::~New()
+{
+	if (thread) delete thread;
 }
 
 int New::create_objects()
@@ -36,19 +42,21 @@
 {
 	if(thread->running())
 	{
+		thread->window_lock.lock();
 		thread->nwindow->raise_window();
-		return 1;
+		thread->window_lock.unlock();
+	} else 
+	{
+		mwindow->edl->save_defaults(mwindow->defaults);
+		create_new_edl();
+		thread->start(); 
 	}
-	mwindow->edl->save_defaults(mwindow->defaults);
-	create_new_edl();
-	thread->start(); 
-
 	return 1;
 }
 
 void New::create_new_edl()
 {
-	new_edl = new EDL;
+	new_edl = new EDL;             // FIXME, what about deleting?
 	new_edl->create_objects();
 	new_edl->load_defaults(mwindow->defaults);
 }
@@ -95,7 +103,7 @@
 }
 
 NewThread::NewThread(MWindow *mwindow, New *new_project)
- : Thread()
+ : Thread("New")
 {
 	this->mwindow = mwindow;
 	this->new_project = new_project;
@@ -103,6 +111,16 @@
 
 NewThread::~NewThread()
 {
+	if (running()) 
+	{
+		window_lock.lock();
+		if (nwindow) {
+			nwindow->set_done(0);
+		}
+		window_lock.unlock();
+		join();
+		printf("setformat joined\n");
+	}
 }
 
 
@@ -112,10 +130,14 @@
 	load_defaults();
 
 	{
+		window_lock.lock();
 		nwindow = new NewWindow(mwindow, this);
 		nwindow->create_objects();
+		window_lock.unlock();
 		result = nwindow->run_window();
+		window_lock.lock();
 		delete nwindow;	
+		window_lock.unlock();
 //printf("NewThread::run 1\n");
 		new_project->new_edl->save_defaults(mwindow->defaults);
 //printf("NewThread::run 2\n");
diff -u base/cinelerra/newfolder.C hvirtual-1.1.5/cinelerra/newfolder.C
--- base/cinelerra/newfolder.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/newfolder.C	2003-05-01 21:18:02.000000000 +0200
@@ -47,7 +47,7 @@
 }
 
 
-NewFolderThread::NewFolderThread(MWindow *mwindow, AWindowGUI *awindow)
+NewFolderThread::NewFolderThread(MWindow *mwindow, AWindowGUI *awindow) : Thread("NewFolder")
 {
 	this->mwindow = mwindow;
 	this->awindow = awindow;
diff -u base/cinelerra/new.h hvirtual-1.1.5/cinelerra/new.h
--- base/cinelerra/new.h	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/new.h	2003-05-01 17:33:04.000000000 +0200
@@ -17,6 +17,7 @@
 {
 public:
 	New(MWindow *mwindow);
+	~New();
 	int create_objects();
 
 	int handle_event();
@@ -45,6 +46,8 @@
 	int update_aspect();
 	int auto_aspect;
 	int auto_sizes;
+	
+	Mutex window_lock;
 	NewWindow *nwindow;
 	MWindow *mwindow;
 	New *new_project;
diff -u base/cinelerra/playbackengine.C hvirtual-1.1.5/cinelerra/playbackengine.C
--- base/cinelerra/playbackengine.C	2003-05-02 19:16:35.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/playbackengine.C	2003-05-01 21:18:50.000000000 +0200
@@ -19,7 +19,7 @@
 #include "arender.h"
 
 PlaybackEngine::PlaybackEngine(MWindow *mwindow, Canvas *output)
- : Thread()
+ : Thread("PlaybackEngine")
 {
 	this->mwindow = mwindow;
 	this->output = output;
diff -u base/cinelerra/pluginclient.h hvirtual-1.1.5/cinelerra/pluginclient.h
--- base/cinelerra/pluginclient.h	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/pluginclient.h	2003-05-01 22:07:27.000000000 +0200
@@ -69,7 +69,7 @@
 
 #define PLUGIN_THREAD_OBJECT(plugin_class, thread_class, window_class) \
 thread_class::thread_class(plugin_class *plugin) \
- : Thread() \
+ : Thread("PLUGIN_THREAD_OBJECT") \
 { \
 	this->plugin = plugin; \
 	set_synchronous(0); \
diff -u base/cinelerra/plugindialog.C hvirtual-1.1.5/cinelerra/plugindialog.C
--- base/cinelerra/plugindialog.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/plugindialog.C	2003-05-01 21:19:34.000000000 +0200
@@ -15,7 +15,7 @@
 
 
 PluginDialogThread::PluginDialogThread(MWindow *mwindow)
- : Thread()
+ : Thread("PluginDialog")
 {
 	this->mwindow = mwindow;
 	window = 0;
diff -u base/cinelerra/preferencesthread.C hvirtual-1.1.5/cinelerra/preferencesthread.C
--- base/cinelerra/preferencesthread.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/preferencesthread.C	2003-05-01 21:47:19.000000000 +0200
@@ -57,7 +57,7 @@
 
 
 PreferencesThread::PreferencesThread(MWindow *mwindow)
- : Thread()
+ : Thread("Preferences")
 {
 	this->mwindow = mwindow;
 	window = 0;
diff -u base/cinelerra/quit.C hvirtual-1.1.5/cinelerra/quit.C
--- base/cinelerra/quit.C	2003-05-01 15:10:50.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/quit.C	2003-05-01 21:54:21.000000000 +0200
@@ -18,7 +18,7 @@
 #include <unistd.h>
 
 Quit::Quit(MWindow *mwindow)
- : BC_MenuItem("Quit", "q", 'q'), Thread() 
+ : BC_MenuItem("Quit", "q", 'q'), Thread("Quit") 
 { 
 	this->mwindow = mwindow; 
 }
diff -u base/cinelerra/recordaudio.C hvirtual-1.1.5/cinelerra/recordaudio.C
--- base/cinelerra/recordaudio.C	2003-05-01 15:10:50.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/recordaudio.C	2003-05-01 21:57:37.000000000 +0200
@@ -23,7 +23,7 @@
 RecordAudio::RecordAudio(MWindow *mwindow,
 				Record *record, 
 				RecordThread *record_thread)
- : Thread()
+ : Thread("RecordAudio")
 {
 	this->mwindow = mwindow;
 	this->record = record;
diff -u base/cinelerra/record.C hvirtual-1.1.5/cinelerra/record.C
--- base/cinelerra/record.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/record.C	2003-05-01 21:54:37.000000000 +0200
@@ -96,7 +96,7 @@
 
 
 Record::Record(MWindow *mwindow, RecordMenuItem *menu_item)
- : Thread()
+ : Thread("Record")
 {
 	this->mwindow = mwindow;
 	this->menu_item = menu_item;
diff -u base/cinelerra/recordgui.C hvirtual-1.1.5/cinelerra/recordgui.C
--- base/cinelerra/recordgui.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/recordgui.C	2003-05-01 21:58:15.000000000 +0200
@@ -1029,7 +1029,7 @@
 
 
 RecordCancelThread::RecordCancelThread(Record *record, RecordGUI *record_gui)
- : Thread()
+ : Thread("RecordCancel")
 {
 	this->record = record;
 	this->gui = record_gui;
@@ -1072,7 +1072,7 @@
 
 
 RecordStartoverThread::RecordStartoverThread(Record *record, RecordGUI *record_gui)
- : Thread()
+ : Thread("RecordStartover")
 {
 	this->record = record;
 	this->gui = record_gui;
@@ -1313,7 +1313,7 @@
 
 
 RecordStatusThread::RecordStatusThread(MWindow *mwindow, RecordGUI *gui)
- : Thread()
+ : Thread("RecordStatus")
 {
 	set_synchronous(1);
 	this->mwindow = mwindow;
diff -u base/cinelerra/recordmonitor.C hvirtual-1.1.5/cinelerra/recordmonitor.C
--- base/cinelerra/recordmonitor.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/recordmonitor.C	2003-05-01 21:58:42.000000000 +0200
@@ -21,7 +21,7 @@
 #include "videodevice.h"
 
 RecordMonitor::RecordMonitor(MWindow *mwindow, Record *record)
- : Thread(1)
+ : Thread("RecordMonitor", 1)
 {
 	this->mwindow = mwindow;
 	this->record = record;
@@ -625,7 +625,7 @@
 RecordMonitorThread::RecordMonitorThread(MWindow *mwindow, 
 	Record *record, 
 	RecordMonitor *record_monitor)
- : Thread()
+ : Thread("RecordMonitor")
 {
 	this->mwindow = mwindow;
 	this->record_monitor = record_monitor;
diff -u base/cinelerra/recordthread.C hvirtual-1.1.5/cinelerra/recordthread.C
--- base/cinelerra/recordthread.C	2003-05-01 15:10:50.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/recordthread.C	2003-05-01 21:59:05.000000000 +0200
@@ -16,7 +16,7 @@
 
 
 RecordThread::RecordThread(MWindow *mwindow, Record *record)
- : Thread()
+ : Thread("RecordThread")
 {
 	this->mwindow = mwindow;
 	this->record = record;
diff -u base/cinelerra/recordvideo.C hvirtual-1.1.5/cinelerra/recordvideo.C
--- base/cinelerra/recordvideo.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/recordvideo.C	2003-05-01 21:59:21.000000000 +0200
@@ -25,7 +25,7 @@
 RecordVideo::RecordVideo(MWindow *mwindow,
 	Record *record, 
 	RecordThread *record_thread)
- : Thread()
+ : Thread("RecordVideo")
 {
 	reset_parameters();
 	this->mwindow = mwindow;
diff -u base/cinelerra/render.C hvirtual-1.1.5/cinelerra/render.C
--- base/cinelerra/render.C	2003-05-02 19:16:35.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/render.C	2003-05-01 21:59:53.000000000 +0200
@@ -72,7 +72,7 @@
 
 
 RenderProgress::RenderProgress(MWindow *mwindow, Render *render)
- : Thread()
+ : Thread("RenderProgress")
 {
 	this->mwindow = mwindow;
 	this->render = render;
@@ -156,7 +156,7 @@
 
 
 Render::Render(MWindow *mwindow)
- : Thread()
+ : Thread("Render")
 {
 	this->mwindow = mwindow;
 	in_progress = 0;
diff -u base/cinelerra/renderengine.C hvirtual-1.1.5/cinelerra/renderengine.C
--- base/cinelerra/renderengine.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/renderengine.C	2003-05-02 19:34:20.000000000 +0200
@@ -25,7 +25,7 @@
 	ArrayList<PluginServer*> *plugindb,
 	ArrayList<Channel*> *channeldb,
 	int head_number)
- : Thread()
+ : Thread("RenderEngine")
 {
 	this->playback_engine = playback_engine;
 	this->output = output;
@@ -405,7 +405,7 @@
 //printf("RenderEngine::start_command 1 %d\n", command->realtime);
 	if(command->realtime)
 	{
-		interrupt_lock.lock();
+//		interrupt_lock.lock();     // FIXME this is unneeded and causes deadlock with valgrind?
 		start_lock.lock();
 		Thread::start();
 		start_lock.lock();
diff -u base/cinelerra/renderfarm.C hvirtual-1.1.5/cinelerra/renderfarm.C
--- base/cinelerra/renderfarm.C	2003-05-01 15:10:51.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/renderfarm.C	2003-05-01 22:00:44.000000000 +0200
@@ -106,7 +106,7 @@
 RenderFarmServerThread::RenderFarmServerThread(MWindow *mwindow, 
 	RenderFarmServer *server, 
 	int number)
- : Thread()
+ : Thread("RenderFarmServer")
 {
 	this->mwindow = mwindow;
 	this->server = server;
diff -u base/cinelerra/renderfarmclient.C hvirtual-1.1.5/cinelerra/renderfarmclient.C
--- base/cinelerra/renderfarmclient.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/renderfarmclient.C	2003-05-01 22:00:13.000000000 +0200
@@ -189,7 +189,7 @@
 // after every frame for the error status.
 // Detaches when finished.
 RenderFarmClientThread::RenderFarmClientThread(RenderFarmClient *client)
- : Thread()
+ : Thread("RenderFramClient")
 {
 	this->client = client;
 	frames_per_second = 0;
diff -u base/cinelerra/resizetrackthread.C hvirtual-1.1.5/cinelerra/resizetrackthread.C
--- base/cinelerra/resizetrackthread.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/resizetrackthread.C	2003-05-01 22:01:12.000000000 +0200
@@ -13,7 +13,7 @@
 
 
 ResizeTrackThread::ResizeTrackThread(MWindow *mwindow, int track_number)
- : Thread()
+ : Thread("ResizeTrack")
 {
 	this->mwindow = mwindow;
 	this->track_number = track_number;
diff -u base/cinelerra/savefile.C hvirtual-1.1.5/cinelerra/savefile.C
--- base/cinelerra/savefile.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/savefile.C	2003-05-01 22:01:33.000000000 +0200
@@ -105,7 +105,7 @@
 }
 
 SaveAs::SaveAs(MWindow *mwindow)
- : BC_MenuItem("Save as...", ""), Thread()
+ : BC_MenuItem("Save as...", ""), Thread("SaveAs")
 { 
 	this->mwindow = mwindow; 
 	quit_now = 0;
diff -u base/cinelerra/setformat.C hvirtual-1.1.5/cinelerra/setformat.C
--- base/cinelerra/setformat.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/setformat.C	2003-05-01 22:01:54.000000000 +0200
@@ -26,29 +26,45 @@
 	thread = new SetFormatThread(mwindow);
 }
 
+SetFormat::~SetFormat() 
+{
+	delete thread;
+}
+
 int SetFormat::handle_event()
 {
-	if(!thread->running())
+	if(thread->running())
 	{
-		thread->start();
-	}
-	else
-	{
-		thread->window_lock->lock();
+		thread->window_lock.lock();
 		if(thread->window) thread->window->raise_window();
-		thread->window_lock->unlock();
+		thread->window_lock.unlock();
+	} else
+	{
+		thread->start();
 	}
 	return 1;
 }
 
 SetFormatThread::SetFormatThread(MWindow *mwindow)
- : Thread()
+ : Thread("SetFormat", 1)	// so we can join at the end
 {
 	this->mwindow = mwindow;
-	window_lock = new Mutex;
 	window = 0;
 }
 
+SetFormatThread::~SetFormatThread() 
+{
+	if (running()) 
+	{
+		window_lock.lock();
+		if (window) {
+			window->set_done(0);
+		}
+		window_lock.unlock();
+		join();
+		printf("setformat joined\n");
+	}
+}
 void SetFormatThread::run()
 {
 	orig_dimension[0] = dimension[0] = mwindow->edl->session->output_w;
@@ -61,18 +77,18 @@
 	new_settings->create_objects();
 	new_settings->copy_session(mwindow->edl);
 
-	window_lock->lock();
+	window_lock.lock();
 	window = new SetFormatWindow(mwindow, this);
 	window->create_objects();
-	window_lock->unlock();
+	window_lock.unlock();
 
 	int result = window->run_window();
 
 
-	window_lock->lock();
+	window_lock.lock();
 	delete window;
 	window = 0;
-	window_lock->unlock();
+	window_lock.unlock();
 
 
 	if(!result)
diff -u base/cinelerra/setformat.h hvirtual-1.1.5/cinelerra/setformat.h
--- base/cinelerra/setformat.h	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/setformat.h	2003-05-01 17:28:19.000000000 +0200
@@ -15,6 +15,7 @@
 {
 public:
 	SetFormat(MWindow *mwindow);
+	~SetFormat();
 	int handle_event();
 	SetFormatThread *thread;
 	MWindow *mwindow;
@@ -25,6 +26,7 @@
 {
 public:
 	SetFormatThread(MWindow *mwindow);
+	~SetFormatThread();
 
 	void run();
 
@@ -34,7 +36,7 @@
 
 
 
-	Mutex *window_lock;
+	Mutex window_lock;
 	SetFormatWindow *window;
 	MWindow *mwindow;
 	EDL *new_settings;
diff -u base/cinelerra/theme.C hvirtual-1.1.5/cinelerra/theme.C
--- base/cinelerra/theme.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/theme.C	2003-05-02 17:01:24.000000000 +0200
@@ -119,7 +119,7 @@
 
 	delete about_bg;
 	delete about_microsoft;
-	delete [] appendasset_data;
+//	delete [] appendasset_data;
 
 
 //	delete [] append_data;    This is never allocated
diff -u base/cinelerra/threadexec.C hvirtual-1.1.5/cinelerra/threadexec.C
--- base/cinelerra/threadexec.C	2003-05-01 15:10:50.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/threadexec.C	2003-05-01 22:02:17.000000000 +0200
@@ -14,7 +14,7 @@
 
 
 ThreadExec::ThreadExec()
- : Thread()
+ : Thread("ThreadExec")
 {
 	Thread::set_synchronous(1);
 	arguments = new char*[MAX_ARGS];
diff -u base/cinelerra/threadindexer.C hvirtual-1.1.5/cinelerra/threadindexer.C
--- base/cinelerra/threadindexer.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/threadindexer.C	2003-05-01 22:02:33.000000000 +0200
@@ -12,7 +12,7 @@
 #include <string.h>
 
 ThreadIndexer::ThreadIndexer(MWindow *mwindow, Assets *assets)
- : Thread()
+ : Thread("ThreadIndexer")
 {
 	this->mwindow = mwindow;
 	this->assets = assets;
diff -u base/cinelerra/threadloader.C hvirtual-1.1.5/cinelerra/threadloader.C
--- base/cinelerra/threadloader.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/threadloader.C	2003-05-01 22:02:50.000000000 +0200
@@ -4,7 +4,7 @@
 // loads command line filenames at startup
 
 ThreadLoader::ThreadLoader(MWindow *mwindow)
- : Thread()
+ : Thread("ThreadLoader")
 {
 	this->mwindow = mwindow;
 }
diff -u base/cinelerra/tracking.C hvirtual-1.1.5/cinelerra/tracking.C
--- base/cinelerra/tracking.C	2003-05-02 19:16:35.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/tracking.C	2003-05-01 22:03:11.000000000 +0200
@@ -28,7 +28,7 @@
 
 
 Tracking::Tracking(MWindow *mwindow)
- : Thread()
+ : Thread("Tracking")
 {
 	this->gui = mwindow->gui;
 	this->mwindow = mwindow; 
diff -u base/cinelerra/transition.C hvirtual-1.1.5/cinelerra/transition.C
--- base/cinelerra/transition.C	2003-05-01 15:10:48.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/transition.C	2003-05-01 22:03:32.000000000 +0200
@@ -35,7 +35,7 @@
 
 
 PasteTransition::PasteTransition(MWindow *mwindow, int audio, int video)
- : Thread()
+ : Thread("PasteTransition")
 {
 	this->mwindow = mwindow;
 	this->audio = audio;
diff -u base/cinelerra/transitionpopup.C hvirtual-1.1.5/cinelerra/transitionpopup.C
--- base/cinelerra/transitionpopup.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/transitionpopup.C	2003-05-02 18:36:40.000000000 +0200
@@ -12,7 +12,7 @@
 
 
 TransitionLengthThread::TransitionLengthThread(MWindow *mwindow, TransitionPopup *popup)
- : Thread()
+ : Thread("TransitionLength")
 {
 	this->mwindow = mwindow;
 	this->popup = popup;
@@ -52,15 +52,18 @@
 
 TransitionLengthDialog::~TransitionLengthDialog()
 {
+	delete title_1;
+	delete text;
+	delete button_1;
 }
 
 	
 void TransitionLengthDialog::create_objects()
 {
-	add_subwindow(new BC_Title(10, 10, "Seconds:"));
+	add_subwindow(title_1 = new BC_Title(10, 10, "Seconds:"));
 	text = new TransitionLengthText(mwindow, this, 100, 10);
 	text->create_objects();
-	add_subwindow(new BC_OKButton(this));
+	add_subwindow(button_1 = new BC_OKButton(this));
 	show_window();
 }
 
@@ -129,6 +132,11 @@
 TransitionPopup::~TransitionPopup()
 {
 //	delete dialog_thread;
+	delete length_thread;
+	delete show;
+	delete on;
+	delete length;
+	delete detach;
 }
 
 
diff -u base/cinelerra/transitionpopup.h hvirtual-1.1.5/cinelerra/transitionpopup.h
--- base/cinelerra/transitionpopup.h	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/transitionpopup.h	2003-05-02 18:37:18.000000000 +0200
@@ -38,6 +38,8 @@
 	MWindow *mwindow;
 	Transition *transition;
 	TransitionLengthText *text;
+	BC_Title *title_1;
+	BC_Button *button_1;
 };
 
 class TransitionLengthText : public BC_TumbleTextBox
diff -u base/cinelerra/videodevice.C hvirtual-1.1.5/cinelerra/videodevice.C
--- base/cinelerra/videodevice.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/videodevice.C	2003-05-01 22:04:15.000000000 +0200
@@ -18,7 +18,7 @@
 #include "vframe.h"
 
 
-KeepaliveThread::KeepaliveThread(VideoDevice *device) : Thread()
+KeepaliveThread::KeepaliveThread(VideoDevice *device) : Thread("Keepalive")
 {
 	still_alive = 1;
 	failed = 0;
diff -u base/cinelerra/virtualconsole.C hvirtual-1.1.5/cinelerra/virtualconsole.C
--- base/cinelerra/virtualconsole.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/virtualconsole.C	2003-05-01 22:04:35.000000000 +0200
@@ -18,7 +18,7 @@
 VirtualConsole::VirtualConsole(RenderEngine *renderengine, 
 	CommonRender *commonrender,
 	int data_type)
- : Thread()
+ : Thread("VirtualConsole")
 {
 	this->renderengine = renderengine;
 	this->commonrender = commonrender;
diff -u base/cinelerra/vwindow.C hvirtual-1.1.5/cinelerra/vwindow.C
--- base/cinelerra/vwindow.C	2003-05-02 19:16:23.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/vwindow.C	2003-05-01 22:05:04.000000000 +0200
@@ -19,7 +19,7 @@
 #include "vwindowgui.h"
 
 
-VWindow::VWindow(MWindow *mwindow) : Thread(1)       // so we can join later...
+VWindow::VWindow(MWindow *mwindow) : Thread("VWindow", 1)       // so we can join later...
 {
 	this->mwindow = mwindow;
 	edl = 0;
diff -u base/cinelerra/vwindowgui.C hvirtual-1.1.5/cinelerra/vwindowgui.C
--- base/cinelerra/vwindowgui.C	2003-05-01 15:10:47.000000000 +0200
+++ hvirtual-1.1.5/cinelerra/vwindowgui.C	2003-05-02 17:44:36.000000000 +0200
@@ -43,11 +43,22 @@
 {
 	this->mwindow = mwindow;
 	this->vwindow = vwindow;
+	in_point = 0;
+	out_point = 0;
 }
 
 VWindowGUI::~VWindowGUI()
 {
+	labels.remove_all_objects();
+	if (in_point) delete in_point;
+	if (out_point) delete out_point;
+	delete meters;
+	delete edit_panel;
 	delete canvas;
+//	delete fps_title;
+	delete clock;
+	delete timebar;
+	delete slider;
 	delete transport;
 }
 
diff -r -u base/plugins/blur/blur.C hvirtual-1.1.5/plugins/blur/blur.C
--- base/plugins/blur/blur.C	2003-05-01 15:11:44.000000000 +0200
+++ hvirtual-1.1.5/plugins/blur/blur.C	2003-05-01 22:34:55.000000000 +0200
@@ -320,7 +320,7 @@
 
 
 BlurEngine::BlurEngine(BlurMain *plugin, int start_out, int end_out)
- : Thread()
+ : Thread("Plugin - Blur")
 {
 	int size = plugin->input->get_w() > plugin->input->get_h() ? 
 		plugin->input->get_w() : plugin->input->get_h();
diff -r -u base/plugins/colorbalance/colorbalance.C hvirtual-1.1.5/plugins/colorbalance/colorbalance.C
--- base/plugins/colorbalance/colorbalance.C	2003-05-01 15:12:10.000000000 +0200
+++ hvirtual-1.1.5/plugins/colorbalance/colorbalance.C	2003-05-01 22:35:36.000000000 +0200
@@ -63,7 +63,7 @@
 
 
 ColorBalanceEngine::ColorBalanceEngine(ColorBalanceMain *plugin)
- : Thread()
+ : Thread("Plugin - ColorBalance")
 {
 	this->plugin = plugin;
 	last_frame = 0;
diff -r -u base/plugins/colors/colorpicker.C hvirtual-1.1.5/plugins/colors/colorpicker.C
--- base/plugins/colors/colorpicker.C	2003-05-01 15:12:12.000000000 +0200
+++ hvirtual-1.1.5/plugins/colors/colorpicker.C	2003-05-01 22:33:55.000000000 +0200
@@ -8,7 +8,7 @@
 #include <unistd.h>
 
 ColorThread::ColorThread(int do_alpha, char *title)
- : Thread()
+ : Thread("Plugin-ColorPicker")
 {
 	window = 0;
 	this->title = title;
diff -r -u base/plugins/delayaudio/delayaudio.C hvirtual-1.1.5/plugins/delayaudio/delayaudio.C
--- base/plugins/delayaudio/delayaudio.C	2003-05-01 15:12:06.000000000 +0200
+++ hvirtual-1.1.5/plugins/delayaudio/delayaudio.C	2003-05-01 22:36:04.000000000 +0200
@@ -229,7 +229,7 @@
 
 
 DelayAudioThread::DelayAudioThread(DelayAudio *plugin)
- : Thread()
+ : Thread("Plugin - DelayAudio")
 {
 	this->plugin = plugin;
 	set_synchronous(0);
diff -r -u base/plugins/delayvideo/delayvideo.C hvirtual-1.1.5/plugins/delayvideo/delayvideo.C
--- base/plugins/delayvideo/delayvideo.C	2003-05-01 15:12:07.000000000 +0200
+++ hvirtual-1.1.5/plugins/delayvideo/delayvideo.C	2003-05-01 22:37:03.000000000 +0200
@@ -138,7 +138,7 @@
 
 
 DelayVideoThread::DelayVideoThread(DelayVideo *plugin)
- : Thread()
+ : Thread("Plugin - DelayVideo")
 {
 	this->plugin = plugin;
 	set_synchronous(0);
diff -r -u base/plugins/holo/holowindow.C hvirtual-1.1.5/plugins/holo/holowindow.C
--- base/plugins/holo/holowindow.C	2003-05-01 15:11:46.000000000 +0200
+++ hvirtual-1.1.5/plugins/holo/holowindow.C	2003-05-01 22:37:51.000000000 +0200
@@ -3,7 +3,7 @@
 
 
 HoloThread::HoloThread(HoloMain *client)
- : Thread()
+ : Thread("Plugin - Holo")
 {
 	this->client = client;
 	set_synchronous(0);
diff -r -u base/plugins/ivtc/ivtc.C hvirtual-1.1.5/plugins/ivtc/ivtc.C
--- base/plugins/ivtc/ivtc.C	2003-05-01 15:11:47.000000000 +0200
+++ hvirtual-1.1.5/plugins/ivtc/ivtc.C	2003-05-01 22:39:14.000000000 +0200
@@ -441,7 +441,7 @@
 
 
 IVTCEngine::IVTCEngine(IVTCMain *plugin, int start_y, int end_y)
- : Thread()
+ : Thread("Plugin - IVTCEngine")
 {
 	this->plugin = plugin;
 	set_synchronous(1);
diff -r -u base/plugins/ivtc/ivtcwindow.C hvirtual-1.1.5/plugins/ivtc/ivtcwindow.C
--- base/plugins/ivtc/ivtcwindow.C	2003-05-01 15:11:47.000000000 +0200
+++ hvirtual-1.1.5/plugins/ivtc/ivtcwindow.C	2003-05-01 22:39:02.000000000 +0200
@@ -3,7 +3,7 @@
 
 
 IVTCThread::IVTCThread(IVTCMain *client)
- : Thread()
+ : Thread("Plugin - IVTCThread")
 {
 	this->client = client;
 	set_synchronous(0);
diff -r -u base/plugins/pitch/pitch.C hvirtual-1.1.5/plugins/pitch/pitch.C
--- base/plugins/pitch/pitch.C	2003-05-01 15:11:57.000000000 +0200
+++ hvirtual-1.1.5/plugins/pitch/pitch.C	2003-05-01 22:39:41.000000000 +0200
@@ -284,7 +284,7 @@
 
 
 PitchThread::PitchThread(PitchEffect *plugin)
- : Thread()
+ : Thread("Plugin - Pitch")
 {
 	this->plugin = plugin;
 	set_synchronous(0);
diff -r -u base/plugins/reverb/reverb.C hvirtual-1.1.5/plugins/reverb/reverb.C
--- base/plugins/reverb/reverb.C	2003-05-01 15:12:22.000000000 +0200
+++ hvirtual-1.1.5/plugins/reverb/reverb.C	2003-05-01 22:40:08.000000000 +0200
@@ -434,7 +434,7 @@
 }
 
 ReverbEngine::ReverbEngine(Reverb *plugin)
- : Thread()
+ : Thread("Plugin - Reverb")
 {
 	this->plugin = plugin;
 	completed = 0;
diff -r -u base/plugins/reverb/reverbwindow.C hvirtual-1.1.5/plugins/reverb/reverbwindow.C
--- base/plugins/reverb/reverbwindow.C	2003-05-01 15:12:22.000000000 +0200
+++ hvirtual-1.1.5/plugins/reverb/reverbwindow.C	2003-05-01 22:41:11.000000000 +0200
@@ -390,7 +390,7 @@
 
 
 ReverbSaveThread::ReverbSaveThread(Reverb *reverb, ReverbMenu *menu)
- : Thread()
+ : Thread("Plugin - ReverbSave")
 {
 	this->reverb = reverb;
 	this->menu = menu;
@@ -440,7 +440,7 @@
 
 
 ReverbLoadThread::ReverbLoadThread(Reverb *reverb, ReverbMenu *menu)
- : Thread()
+ : Thread("Plugin - ReverbLoad")
 {
 	this->reverb = reverb;
 	this->menu = menu;
@@ -468,7 +468,8 @@
 	}
 }
 
-ReverbLoadPrevThread::ReverbLoadPrevThread(Reverb *reverb, ReverbMenu *menu) : Thread()
+ReverbLoadPrevThread::ReverbLoadPrevThread(Reverb *reverb, ReverbMenu *menu) 
+: Thread("Plugin - ReverbLoadPrev")
 {
 	this->reverb = reverb;
 	this->menu = menu;
diff -r -u base/plugins/sharpen/sharpen.C hvirtual-1.1.5/plugins/sharpen/sharpen.C
--- base/plugins/sharpen/sharpen.C	2003-05-01 15:12:06.000000000 +0200
+++ hvirtual-1.1.5/plugins/sharpen/sharpen.C	2003-05-01 22:41:41.000000000 +0200
@@ -305,7 +305,7 @@
 
 
 SharpenEngine::SharpenEngine(SharpenMain *plugin)
- : Thread()
+ : Thread("Plugin - Sharpen")
 {
 	this->plugin = plugin;
 	last_frame = 0;
diff -r -u base/plugins/swapchannels/swapchannels.C hvirtual-1.1.5/plugins/swapchannels/swapchannels.C
--- base/plugins/swapchannels/swapchannels.C	2003-05-01 15:12:01.000000000 +0200
+++ hvirtual-1.1.5/plugins/swapchannels/swapchannels.C	2003-05-02 19:09:41.000000000 +0200
@@ -186,6 +186,7 @@
 {
 	PLUGIN_DESTRUCTOR_MACRO
 	
+	if (defaults) delete defaults;
 	if(temp) delete temp;
 }
 
diff -r -u base/plugins/synthesizer/synthesizer.C hvirtual-1.1.5/plugins/synthesizer/synthesizer.C
--- base/plugins/synthesizer/synthesizer.C	2003-05-01 15:12:01.000000000 +0200
+++ hvirtual-1.1.5/plugins/synthesizer/synthesizer.C	2003-05-01 22:42:22.000000000 +0200
@@ -487,7 +487,7 @@
 
 
 SynthThread::SynthThread(Synth *synth)
- : Thread()
+ : Thread("Plugin - Synth")
 {
 	this->synth = synth;
 	set_synchronous(0);
diff -r -u base/plugins/titler/titlewindow.C hvirtual-1.1.5/plugins/titler/titlewindow.C
--- base/plugins/titler/titlewindow.C	2003-05-01 15:12:23.000000000 +0200
+++ hvirtual-1.1.5/plugins/titler/titlewindow.C	2003-05-01 22:43:00.000000000 +0200
@@ -4,7 +4,7 @@
 #include <string.h>
 
 TitleThread::TitleThread(TitleMain *client)
- : Thread()
+ : Thread("Plugin - TitleThread")
 {
 	this->client = client;
 	set_synchronous(0);
