Opened 5 years ago

Closed 5 years ago

#9777 closed Bugs (invalid)

signals2 null shared_ptr dereference

Reported by: dkomisar@… Owned by: Frank Mori Hess
Milestone: To Be Determined Component: signals2
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:


I've checked that this still in trunk but I didn't check to see if anything else had changed.

signals2/detail/signal_template.hpp line 490 in 1.46.1:

// if the connection list passed in as a parameter is no longer in use,
// we don't need to do any cleanup.
if(&_shared_state->connection_bodies() != connection_bodies)

connection_bodies returns a reference which is a dereferenced shared_ptr. With the shared_ptr as null I believe this code would work as intended if the null were not dereferenced (and then caught by a static assert before it actually happens).

I'm currently testing a fix that tests against the address directly. If that doesn't work I don't know what the problem is.

Change History (4)

comment:1 Changed 5 years ago by Frank Mori Hess

Do you have example code that reproduces the problem?

comment:2 in reply to:  1 Changed 5 years ago by dkomisar@…

Replying to fmhess:

Do you have example code that reproduces the problem?

Not one that I can reproduce outside the environment I'm in.

I looked through the code and I'm not sure how that pointer could ever get unset, so maybe there's something else going on. I know that the object which the signal is in is not getting deleted so even if I screwed something up it shouldn't crash where it's crashing. I'll see if I can figure out a way to reproduce it for you.

comment:3 Changed 5 years ago by dkomisar@…

This was apparently caused by some deletion ordering stuff where the signal was deleted within one of the slots. I changed the code to use shared poitners to refer to the signal and it now works. I was under the impression this was supposed to work so I've probably done something else wrong somewhere else.

comment:4 Changed 5 years ago by Frank Mori Hess

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.