Re: [MSVC] - Compiler option "/vd2"



Hi Marcin - you raised a couple of interesting points here:-

1st point:
On 07/09/2014 20:33, Marcin Kolny wrote:

Could you tell us, what exactly problems have you met with /vd2 flag?


If I add the /vd2 flag to my own program (and rebuild, of course) the program runs fine but it crashes at shutdown. The crash occurs at this code in '<libsigc++2>/sigc++/signal_base.h'

      struct SIGC_API signal_impl
      {

        //  some stuff

        inline void unreference()
{ if (!(--ref_count_)) delete this; } // <--- CRASH OCCURS HERE !!

        //  some stuff
       };

I'm guessing there's some kind of problem with the 'this' pointer. FWIW it makes no difference if I rebuild libsigc++ after adding the /vd2 flag. The only way I can avoid the crash is to NOT add /vd2, either to libsigc++ or to my own program code.


2nd point:
On 07/09/2014 20:33, Martin Kolny wrote:
if you really would like to remove this flag, you have to know, that you can't use dynamic_cast operator in your consturctors in that case. (I don't know whether it's used somewhere in *mm projects or sigc++, you have to check it).

What's interesting about this is the example code that you supplied originally. AFAICT there wasn't any dynamic_cast operator getting used (either in your own c'tor - or Glib::Object's c'tor - or Glib::ObjectBases's c'tor - or anywhere in libsigc++). And yet the constructed object was clearly not getting initialized properly.

So I'm wondering if it was just a happy accident that /vd2 fixed your original problem (since that wasn't an example of the kind of problem it's intended to fix).

Sadly, I'm still very mystified about what's going on here...  :-(

One thing of note though.... class Glib::ObjectBase is derived from sigc::trackable - but sigc::trackable seems to have a non-virtual d'tor. I suppose that might be a factor in the crash that I'm seeing. I should probably look a bit deeper into this when I can find some time.

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]