From 2e218e32634b70bb3eda9ad1debe8fd089e544d4 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 30 Jul 2002 22:35:43 +0000 Subject: [PATCH] remove io callback on shutdown git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4811 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/frontends/ChangeLog | 4 ++++ src/frontends/lyx_gui.h | 5 +++++ src/frontends/xforms/ChangeLog | 4 ++++ src/frontends/xforms/lyx_gui.C | 6 ++++++ src/lyxserver.C | 16 ++++++++++------ src/lyxserver.h | 2 +- 7 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5f1a60c901..4e4aa4e6e0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-07-30 John Levon + + * lyxserver.h: + * lyxserver.C: remove I/O callback too + 2002-07-30 Jean-Marc Lasgouttes * lyxfunc.C (getStatus): disable LFUN_LATEX_LOG when there is no diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index b946f93e9c..87a176ab5f 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2002-07-30 John Levon + + * lyx_gui.h: add remove_read_callback() + 2002-07-22 John Levon * lyx_gui.h: add exit() diff --git a/src/frontends/lyx_gui.h b/src/frontends/lyx_gui.h index 741688a311..109bb3d229 100644 --- a/src/frontends/lyx_gui.h +++ b/src/frontends/lyx_gui.h @@ -65,6 +65,11 @@ namespace lyx_gui { * add a callback for I/O read notification */ void set_read_callback(int fd, LyXComm * comm); + + /** + * remove a I/O read callback + */ + void remove_read_callback(int fd); } #endif // LYX_GUI_H diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 5e7901aa1e..bdf64be728 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2002-07-30 John Levon + + * lyx_gui.C: implement remove_read_callback() + 2002-07-26 Jean-Marc Lasgouttes * XWorkArea.C (work_area_handler): change type of diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index b424142506..05b418dc3c 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -377,3 +377,9 @@ void lyx_gui::set_read_callback(int fd, LyXComm * comm) { fl_add_io_callback(fd, FL_READ, C_read_callback, comm); } + + +void lyx_gui::remove_read_callback(int fd) +{ + fl_remove_io_callback(fd, FL_READ, C_read_callback); +} diff --git a/src/lyxserver.C b/src/lyxserver.C index e9692fd6f4..9f64d8f9be 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -99,7 +99,7 @@ void LyXComm::openConnection() return; if ((outfd = startPipe(outPipeName(), true)) == -1) { - endPipe(infd, inPipeName()); + endPipe(infd, inPipeName(), false); return; } @@ -132,8 +132,8 @@ void LyXComm::closeConnection() return; } - endPipe(infd, inPipeName()); - endPipe(outfd, outPipeName()); + endPipe(infd, inPipeName(), false); + endPipe(outfd, outPipeName(), true); ready = false; } @@ -207,11 +207,15 @@ int LyXComm::startPipe(string const & filename, bool write) } -void LyXComm::endPipe(int & fd, string const & filename) +void LyXComm::endPipe(int & fd, string const & filename, bool write) { if (fd < 0) return; + if (!write) { + lyx_gui::remove_read_callback(fd); + } + #ifdef __EMX__ APIRET rc; int errnum; @@ -245,8 +249,8 @@ void LyXComm::endPipe(int & fd, string const & filename) void LyXComm::emergencyCleanup() { if (!pipename.empty()) { - endPipe(infd, inPipeName()); - endPipe(outfd, outPipeName()); + endPipe(infd, inPipeName(), false); + endPipe(outfd, outPipeName(), true); } } diff --git a/src/lyxserver.h b/src/lyxserver.h index f6d38868db..3a3c180776 100644 --- a/src/lyxserver.h +++ b/src/lyxserver.h @@ -82,7 +82,7 @@ private: int startPipe(string const &, bool); /// finish a pipe - void endPipe(int &, string const &); + void endPipe(int &, string const &, bool); /// This is -1 if not open int infd; -- 2.39.2