Fix crash on Mac, now the strange part

Part 2: avoid pure virtual function,
          if (theApp)
               theApp->unregisterSocketCallback(fd_);
          does not help, we've tested it!
          Without a Mac it is hard to find a better solution
    



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16110 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2006-11-29 21:36:39 +00:00
parent cdfed1ce7d
commit 1000b8d218
3 changed files with 10 additions and 3 deletions

View File

@ -168,7 +168,8 @@ public:
* remove a I/O read callback
* @param fd socket descriptor (file/socket/etc)
*/
virtual void unregisterSocketCallback(int fd) = 0;
template<class T>
void unregisterSocketCallback(T fd);
/// Create the main window with given geometry settings.
LyXView & createView(unsigned int width, unsigned int height,

View File

@ -277,8 +277,14 @@ void GuiApplication::registerSocketCallback(int fd, boost::function<void()> func
boost::shared_ptr<socket_callback>(new socket_callback(fd, func));
}
template<>
void Application::unregisterSocketCallback<int>(int fd)
{
GuiApplication* ptr = static_cast<GuiApplication*>(this);
ptr->unregisterSocketCallbackImpl(fd);
}
void GuiApplication::unregisterSocketCallback(int fd)
void GuiApplication::unregisterSocketCallbackImpl(int fd)
{
socket_callbacks_.erase(fd);
}

View File

@ -75,7 +75,7 @@ public:
virtual void updateColor(LColor_color col);
virtual void registerSocketCallback(
int fd, boost::function<void()> func);
virtual void unregisterSocketCallback(int fd);
void unregisterSocketCallbackImpl(int fd);
//@}
///