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

| Jean-Marc Lasgouttes wrote:
>> I will. Note that the 'ugly' patch you sent earlier did work
>> perfectly. Will you be willing to apply this one if it works?
>
| It does not seem to work very well:
>
| ginette: patch -p0 <~/rh-magic.patch
| patching file src/BufferView_pimpl.C
| patch: **** malformed patch at line 92: Index:
| src/frontends/xforms/XFormsView.C

Ok, this is the reworked patch. Please test.

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 -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 19:17:57 -0000
@@ -118,8 +118,24 @@ 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,27 +149,27 @@ 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);
 }
@@ -376,7 +392,7 @@ void BufferView::Pimpl::updateScrollbar(
 	}
 
 	LyXText const & t = *bv_->text;
- 
+
 	lyxerr[Debug::GUI] << "Updating scrollbar: h " << t.height << ", first_y "
 		<< t.first_y << ", default height " << t.defaultHeight() << endl;
 
@@ -1301,15 +1317,15 @@ void BufferView::Pimpl::toggleToggle()
 void BufferView::Pimpl::center()
 {
 	LyXText * t = bv_->text;
- 
+
 	beforeChange(t);
 	int const half_height = workarea().workHeight() / 2;
 	int new_y = 0;
- 
+
 	if (t->cursor.y() > half_height) {
 		new_y = t->cursor.y() - half_height;
 	}
- 
+
 	// FIXME: can we do this w/o calling screen directly ?
 	// This updates first_y but means the fitCursor() call
 	// from the update(FITCUR) doesn't realise that we might
@@ -1317,10 +1333,10 @@ void BufferView::Pimpl::center()
 	// the scrollbar to be updated as it should, so we have
 	// to do it manually. Any operation that does a center()
 	// and also might have moved first_y must make sure to call
-	// updateScrollbar() currently. Never mind that this is a 
+	// updateScrollbar() currently. Never mind that this is a
 	// pretty obfuscated way of updating t->first_y
 	screen().draw(t, bv_, new_y);
- 
+
 	update(t, BufferView::SELECT | BufferView::FITCUR);
 }
 
@@ -3267,7 +3283,7 @@ void BufferView::Pimpl::insertAndEditIns
 		if (gotsel)
 			owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION);
 	}
-	else 
+	else
 		delete inset;
 #endif
 }
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 -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 19:17:58 -0000
@@ -35,7 +35,7 @@
 #include "BufferView.h"
 
 #include <boost/bind.hpp>
-
+#include <boost/signals/connection.hpp>
 using std::abs;
 using std::endl;
 
@@ -62,12 +62,12 @@ 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));
 }
 
 
@@ -197,13 +197,13 @@ void XFormsView::message(string const & 
 	minibuffer_->message(str);
 }
 
- 
+
 void XFormsView::show_view_state()
 {
 	message(getLyXFunc()->view_status_message());
 }
- 
- 
+
+
 // How should this actually work? Should it prohibit input in all BufferViews,
 // or just in the current one? If "just the current one", then it should be
 // placed in BufferView. If "all BufferViews" then LyXGUI (I think) should
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 -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 19:17:58 -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 -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 19:17:58 -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 -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 19:17:58 -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,6 +93,14 @@ 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_;
 

-- 
        Lgb

Reply via email to