[Top][All Lists]

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

Re: [Discuss-gnuradio] Possibly incorrect gr_msg_queue.delete_head_nowai

From: Isdren Gineer
Subject: Re: [Discuss-gnuradio] Possibly incorrect gr_msg_queue.delete_head_nowait() implementation
Date: Thu, 3 Oct 2013 15:33:28 -0700

Of course, if 0 is returned, msg2_out would not be an message instance, but it would be possible to check if msg2_out == 0 before trying to call any instance methods.

On Thu, Oct 3, 2013 at 3:27 PM, Isdren Gineer <address@hidden> wrote:
According to the documentation comments, gr_msg_queue::delete_head_nowait() should return 0 if no message is available. The current implementation, however, results in a core dump.

For example, when executed in a script, the eleven lines:

#/usr/bin/env python
from gnuradio import gr
q = gr.msg_queue(1)
msg1_in = gr.message_from_string('msg1 payload')
msg1_out = q.delete_head_nowait()
print 'msg1_out object: %s' % str(msg1_out)
print 'msg1_out value: %s' % msg1_out.to_string()
msg2_out = q.delete_head_nowait()
print 'msg2_out object: %s' % str(msg2_out)
print 'msg2_out value: %s' % msg2_out.to_string()

generate the output:

msg1_out object: <gnuradio.gr.gnuradio_core_runtime.gr_message_sptr; proxy of <Swig Object of type 'gr_message_sptr *' at 0x16529c0> >
msg1_out value: msg1 payload
msg2_out object: <gnuradio.gr.gnuradio_core_runtime.gr_message_sptr; proxy of <Swig Object of type 'gr_message_sptr *' at 0x16529f0> >
python: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = gr_message]: Assertion `px != 0' failed.
Aborted (core dumped)

All of the other gr.msg_queue swig'd functions also cause a core dump.

The definition of gr_msg_queue:delete_head_nowait() includes the block:

  if ((m = d_head) == 0){
    //return 0;
    return gr_message_sptr();

I believe the correct implementation should the 'return 0' line uncommented and the 'return gr_message_sprt()' removed.

reply via email to

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