Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

| >>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:
| 
| Lars> Are you all able to compile and run LyX now without crashes? (if
| Lars> not, I have a patch for you)
| 
| You mean gc 2.96? Currently I have to compile without any optimization
| to get it to work, which is not very convenient...
| 
| Therefore, I'd appreciate any magic patch you may have in store.

Then you should try this:

Index: src/BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.271
diff -u -p -b -B -w -r1.271 BufferView_pimpl.C
--- src/BufferView_pimpl.C	21 Jul 2002 21:20:53 -0000	1.271
+++ src/BufferView_pimpl.C	22 Jul 2002 16:10:30 -0000
@@ -77,6 +77,7 @@
 #include "support/lyxfunctional.h"
 
 #include <boost/bind.hpp>
+#include <boost/signals/connection.hpp>
 
 #include <cstdio>
 #include <ctime>
@@ -118,7 +119,35 @@ extern int bibitemMaxWidth(BufferView *,
 
 namespace {
 
-const unsigned int saved_positions_num = 20;
+unsigned int const saved_positions_num = 20;
+
+// All the below connection objects are needed because of a bug in some
+// versions of GCC (<=2.96 are on the suspects list.) By having and assigning
+// to these connections we avoid a segfault upon startup, and also at exit.
+// (Lgb)
+
+///
+boost::signals::connection timecon;
+///
+boost::signals::connection doccon;
+///
+boost::signals::connection resizecon;
+///
+boost::signals::connection bpresscon;
+///
+boost::signals::connection breleasecon;
+///
+boost::signals::connection motioncon;
+///
+boost::signals::connection doublecon;
+///
+boost::signals::connection triplecon;
+///
+boost::signals::connection kpresscon;
+///
+boost::signals::connection selectioncon;
+///
+boost::signals::connection lostcon;
 
 
 } // anon namespace
@@ -133,28 +162,28 @@ BufferView::Pimpl::Pimpl(BufferView * b,
 	screen_.reset(LyXScreenFactory::create(workarea()));
 
 	// Setup the signals
-	workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
-	workarea().workAreaResize
+	doccon = workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
+	resizecon = workarea().workAreaResize
 		.connect(boost::bind(&BufferView::Pimpl::workAreaResize, this));
-	workarea().workAreaButtonPress
+	bpresscon = workarea().workAreaButtonPress
 		.connect(boost::bind(&BufferView::Pimpl::workAreaButtonPress, this, _1, _2, _3));
-	workarea().workAreaButtonRelease
+	breleasecon = workarea().workAreaButtonRelease
 		.connect(boost::bind(&BufferView::Pimpl::workAreaButtonRelease, this, _1, _2, _3));
-	workarea().workAreaMotionNotify
+	motioncon = workarea().workAreaMotionNotify
 		.connect(boost::bind(&BufferView::Pimpl::workAreaMotionNotify, this, _1, _2, _3));
-	workarea().workAreaDoubleClick
+	doublecon = workarea().workAreaDoubleClick
 		.connect(boost::bind(&BufferView::Pimpl::doubleClick, this, _1, _2, _3));
-	workarea().workAreaTripleClick
+	triplecon = workarea().workAreaTripleClick
 		.connect(boost::bind(&BufferView::Pimpl::tripleClick, this, _1, _2, _3));
-	workarea().workAreaKeyPress
+	kpresscon = workarea().workAreaKeyPress
 		.connect(boost::bind(&BufferView::Pimpl::workAreaKeyPress, this, _1, _2));
-	workarea().selectionRequested
+	selectioncon = workarea().selectionRequested
 		.connect(boost::bind(&BufferView::Pimpl::selectionRequested, this));
-	workarea().selectionLost
+	lostcon = workarea().selectionLost
 		.connect(boost::bind(&BufferView::Pimpl::selectionLost, this));
 
-	cursor_timeout.timeout.connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
+	timecon = cursor_timeout.timeout.connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
 	cursor_timeout.start();
 	saved_positions.resize(saved_positions_num);
 }
Index: src/frontends/xforms/XFormsView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsView.C,v
retrieving revision 1.17
diff -u -p -b -B -w -r1.17 XFormsView.C
--- src/frontends/xforms/XFormsView.C	21 Jul 2002 01:38:24 -0000	1.17
+++ src/frontends/xforms/XFormsView.C	22 Jul 2002 16:10:48 -0000
@@ -35,7 +35,7 @@
 #include "BufferView.h"
 
 #include <boost/bind.hpp>
-
+#include <boost/signals/connection.hpp>
 using std::abs;
 using std::endl;
 
@@ -62,17 +62,18 @@ XFormsView::XFormsView(int width, int he
 	create_form_form_main(*getDialogs(), width, height);
 	fl_set_form_atclose(getForm(), C_XFormsView_atCloseMainFormCB, 0);
 
-	view_state_changed.connect(boost::bind(&XFormsView::show_view_state, this));
-	focus_command_buffer.connect(boost::bind(&XMiniBuffer::focus, minibuffer_.get()));
+	view_state_con = view_state_changed.connect(boost::bind(&XFormsView::show_view_state, this));
+	focus_con = focus_command_buffer.connect(boost::bind(&XMiniBuffer::focus, minibuffer_.get()));
  
 	// Make sure the buttons are disabled if needed.
 	updateToolbar();
-	getDialogs()->redrawGUI.connect(boost::bind(&XFormsView::redraw, this));
+	redraw_con = getDialogs()->redrawGUI.connect(boost::bind(&XFormsView::redraw, this));
 }
 
 
 XFormsView::~XFormsView()
 {
+	//getDialogs()->redrawGUI.disconnect_all_slots();
 	minibuffer_->freeze();
 	fl_hide_form(form_);
 	fl_free_form(form_);
Index: src/frontends/xforms/XFormsView.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsView.h,v
retrieving revision 1.10
diff -u -p -b -B -w -r1.10 XFormsView.h
--- src/frontends/xforms/XFormsView.h	19 Jul 2002 20:56:31 -0000	1.10
+++ src/frontends/xforms/XFormsView.h	22 Jul 2002 16:10:48 -0000
@@ -73,6 +73,13 @@ private:
 	void create_form_form_main(Dialogs & d, int width, int height);
 	/// the minibuffer
 	boost::scoped_ptr<XMiniBuffer> minibuffer_;
+	///
+	boost::signals::connection view_state_con;
+	///
+	boost::signals::connection focus_con;
+	///
+	boost::signals::connection redraw_con;
+	
 	/// the main form.
 	FL_FORM * form_;
 };
Index: src/frontends/xforms/XMiniBuffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XMiniBuffer.C,v
retrieving revision 1.5
diff -u -p -b -B -w -r1.5 XMiniBuffer.C
--- src/frontends/xforms/XMiniBuffer.C	20 Jul 2002 17:27:03 -0000	1.5
+++ src/frontends/xforms/XMiniBuffer.C	22 Jul 2002 16:10:48 -0000
@@ -44,24 +44,24 @@ XMiniBuffer::XMiniBuffer(XFormsView * v,
 	input_obj_ = create_input_box(FL_NORMAL_INPUT, x, y, h, w);
 	info_timer_.reset(new Timeout(1500));
 	idle_timer_.reset(new Timeout(6000));
-	info_timer_->timeout.connect(boost::bind(&XMiniBuffer::info_timeout, this));
-	idle_timer_->timeout.connect(boost::bind(&XMiniBuffer::idle_timeout, this));
+	info_con = info_timer_->timeout.connect(boost::bind(&XMiniBuffer::info_timeout, this));
+	idle_con = idle_timer_->timeout.connect(boost::bind(&XMiniBuffer::idle_timeout, this));
 	idle_timer_->start(); 
 	messageMode();
 }
 
 
+// This is here so that scoped ptr will not require a complete type.
+XMiniBuffer::~XMiniBuffer()
+{}
+
+
 // thanks for nothing, xforms (recursive creation not allowed)
 void XMiniBuffer::dd_init()
 {
 	dropdown_.reset(new DropDown(the_buffer_));
-	dropdown_->result.connect(boost::bind(&XMiniBuffer::set_complete_input, this, _1));
-	dropdown_->keypress.connect(boost::bind(&XMiniBuffer::append_char, this, _1));
-}
-
-
-XMiniBuffer::~XMiniBuffer()
-{
+	result_con = dropdown_->result.connect(boost::bind(&XMiniBuffer::set_complete_input, this, _1));
+	keypress_con = dropdown_->keypress.connect(boost::bind(&XMiniBuffer::append_char, this, _1));
 }
 
 
Index: src/frontends/xforms/XMiniBuffer.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XMiniBuffer.h,v
retrieving revision 1.3
diff -u -p -b -B -w -r1.3 XMiniBuffer.h
--- src/frontends/xforms/XMiniBuffer.h	20 Jul 2002 17:27:03 -0000	1.3
+++ src/frontends/xforms/XMiniBuffer.h	22 Jul 2002 16:10:48 -0000
@@ -15,6 +15,7 @@
 #include FORMS_H_LOCATION
 
 #include <boost/scoped_ptr.hpp>
+#include <boost/signals/connection.hpp>
  
 #ifdef __GNUG__
 #pragma interface
@@ -27,9 +28,11 @@ class Timeout;
 /// in xforms, the minibuffer is both a status bar and a command buffer
 class XMiniBuffer {
 public:
+	///
 	XMiniBuffer(XFormsView * o, ControlCommandBuffer & control,
 		    FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
 
+	///
 	~XMiniBuffer();
 
 	/// create drop down
@@ -50,7 +53,7 @@ public:
 	/// disable event management
 	void freeze();
  
-protected:
+private:
 	/// Are we in editing mode?
 	bool isEditingMode() const;
 
@@ -90,7 +93,15 @@ protected:
 	/// idle timer
 	boost::scoped_ptr<Timeout> idle_timer_;
  
+	///
+	boost::signals::connection info_con;
+	///
+	boost::signals::connection idle_con;
+	///
+	boost::signals::connection result_con;
+	///
+	boost::signals::connection keypress_con;
 	/// This is the input widget object
 	FL_OBJECT * the_buffer_;
 

and report back.

-- 
        Lgb

Reply via email to