Hi Bram,

2016/2/27 Sat 23:28:20 UTC+9 Bram Moolenaar wrote:
> Ken Takata wrote:
> 
> > Hi mattn,
> > 
> > 2016/2/26 Fri 16:37:01 UTC+9 mattn wrote:
> > > gui_dwrite.cpp:348:13: warning: deleting object of polymorphic class type 
> > > 'GdiTextRenderer' which has non-virtual destructor might cause undefined 
> > > behaviour [-Wdelete-non-virtual-dtor]
> > >       delete this;
> > > 
> > > Below is a patch.
> > > 
> > > diff --git a/src/gui_dwrite.cpp b/src/gui_dwrite.cpp
> > > index 08b81c4..52de208 100644
> > > --- a/src/gui_dwrite.cpp
> > > +++ b/src/gui_dwrite.cpp
> > > @@ -237,7 +237,7 @@ public:
> > >   AddRef();
> > >      }
> > >  
> > > -    ~GdiTextRenderer()
> > > +    virtual ~GdiTextRenderer()
> > >      {
> > >   SafeRelease(&pRenderTarget_);
> > >   SafeRelease(&pRenderingParams_);
> > 
> > Another option is using "final" specifier as I already posted:
> > https://groups.google.com/d/msg/vim_dev/ZnGSvwOJZ_4/op_lUvpXEAAJ
> 
> The solution with "virtual" is a lot shorter.  And it doesn't require
> C++11.

OK, then let's do the same thing with if_ole.cpp:

--- a/src/if_ole.cpp
+++ b/src/if_ole.cpp
@@ -96,7 +96,7 @@ static CVim *app = 0;
 class CVim : public IVim
 {
 public:
-    ~CVim();
+    virtual ~CVim();
     static CVim *Create(int *pbDoRestart);
 
     // IUnknown members
@@ -432,6 +432,7 @@ class CVimCF : public IClassFactory
 {
 public:
     static CVimCF *Create();
+    virtual ~CVimCF() {};
 
     STDMETHOD(QueryInterface)(REFIID riid, void ** ppv);
     STDMETHOD_(unsigned long, AddRef)(void);


Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui