]> git.lyx.org Git - features.git/commitdiff
Fix crash on Mac, now the strange part
authorPeter Kümmel <syntheticpp@gmx.net>
Wed, 29 Nov 2006 21:36:39 +0000 (21:36 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Wed, 29 Nov 2006 21:36:39 +0000 (21:36 +0000)
  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

src/frontends/Application.h
src/frontends/qt4/GuiApplication.C
src/frontends/qt4/GuiApplication.h

index 3bd0c226ae1739209b4d407f9b24b2d1f4ee4809..ca0c77e4b10f4a8629a72898334d4d12fca6d5e6 100644 (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,
index ffd1624cc9eca967016ed3ac01c3b4f81c764449..e41fa106ad5f20f68bcd8da46e06a3832ed68bb1 100644 (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);
 }
index 1f609467c73544ab684c47bd0206628d8c1538c9..ed0fe31b422a7fe980b0f5e7a2769aafedb95052 100644 (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);
        //@}
 
        ///