Hi,

this is a bug.

cxxtools::Clock has a pointer to impl and when copied both copies point 
to the same impl and both try to delete it in the destructor.

I fixed the bug by adding reference counting to the impl and 
implementing a copy and assignment operator for cxxtools::Clock.


Tommi

Am 15.07.2014 18:25, schrieb Andreas Welchlin:
> Hi List,
>
> I get a reproducable crash when the destructor of Clock is called after
> using the copy constructor.
>
> These are the lines:
>
> main()
> {
>      cxxtools::Clock clock1;
>      {
>              cxxtools::Clock clock2(clock1);
>      } // **** here it crashes *****
> }
>
>
> I get the message:
>
> *** Error in `./alltest': double free or corruption (fasttop):
> 0x00000000022bf620 ***
> ======= Backtrace: =========
> /lib64/libc.so.6[0x394da7d0b8]
> ./alltest(_ZN19TimespanWatcherTest22copyConstructorOfClockEv+0x43)[0x4c009b]
> ./alltest(_ZNK8cxxtools6MethodIv19TimespanWatcherTestNS_4VoidES2_S2_S2_S2_S2_S2_S2_S2_S2_EclEv+0x66)[0x4c10e6]
> ./alltest(_ZNK8cxxtools8CallableIvNS_4VoidES1_S1_S1_S1_S1_S1_S1_S1_S1_E4callEv+0x23)[0x49316b]
> ./alltest(_ZN8cxxtools4unit15BasicTestMethodI19TimespanWatcherTestNS_4VoidES3_S3_S3_S3_S3_S3_S3_E4execEPKNS_17SerializationInfoEj+0x1f)[0x4c1107]
> /usr/local/lib/libcxxtools-unit.so.9(_ZN8cxxtools4unit11TestContext3runEv+0xb4)[0x7f149cfcdca4]
> /usr/local/lib/libcxxtools-unit.so.9(_ZN8cxxtools4unit9TestSuite6runAllEv+0x64)[0x7f149cfccc54]
> /usr/local/lib/libcxxtools-unit.so.9(_ZN8cxxtools4unit11Application3runEv+0x7a)[0x7f149cfcb6ca]
> ./alltest(main+0x33a)[0x49017a]
>
>
> I don't see any double free when I look into the source.
> Is there anyone with an idea why this happens?
>
> Andreas
>
>
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Tntnet-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tntnet-general


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to