discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Destructor of block never called


From: Martin Braun
Subject: Re: [Discuss-gnuradio] Destructor of block never called
Date: Wed, 14 Oct 2015 09:23:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

On 14.10.2015 00:08, Marius Cachelin wrote:
> Hi,
> 
> You were right, when I click the cross button to close the window, all
> my new objects are deleted, even if my destructor is not called.
> 
> I tried to not using Qt GUI, and instead, using no GUI, but it is the
> same behavior.
> 
> Actually, during the runtime, my application records some information (#
> of packet lost, # of packets send...), and I want to print out these
> information when I close my application.
> 
> So I think I am going to find an other way to do this...

As Sylvain points out, stop() might be a better choice for this.

M

> 
> Thanks you Sylvain for your help.
> 
> Marius
> 
> 2015-10-13 17:15 GMT+02:00 Sylvain Munaut <address@hidden
> <mailto:address@hidden>>:
> 
>     Hi,
> 
> 
>     > Actually, I don't mean the red cross in GRC. My application is run in 
> QT GUI
>     > mode.
>     >  So, is the cross on the top of my window a stop button?
> 
>     Yes, it should stop the flow graph cleanly.
> 
>     However since everything uses smart pointers, it won't "delete" the
>     object at that point and I'm not really sure that the C++ runtime
>     strictly guarantees that all destructors will be called if the object
>     were not deleted. (Since at the process end all the resources would be
>     freed anyway). And GR can't really call delete itself because when
>     using Qt a bunch of object lifetime has been delegated to the Qt
>     runtime.
> 
>     All in all I would _not_ rely on your destructor being called for
>     anything important.
> 
>     stop() will be called for sure though because that part is entirely
>     under our control.
> 
> 
>     Another issue you might be encountering is just plain crashes ... Some
>     time ago I had some crash in GR that went unnoticed just because they
>     would only happen at flowgraph end time ... you can see that in a
>     debugger if you get a SIGSEGV or such.
> 
> 
>     Cheers,
> 
>        Sylvain
> 
> 
> 
> 
> -- 
> *CACHELIN Marius*
> /Ingénieur Systèmes, Réseaux et Télécommunications/
> address@hidden <mailto:address@hidden>
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]