Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object destruction and cross thread signal activation #12

Open
coolcode123 opened this issue Jun 29, 2020 · 1 comment
Open

Object destruction and cross thread signal activation #12

coolcode123 opened this issue Jun 29, 2020 · 1 comment

Comments

@coolcode123
Copy link

I think I've found a serious bug in CsSignal. I had several program crashes before I figured out what was going on.
If we have two objects assigned to two different threads (so these two threads decide when to destroy those objects), and one object gets destroyed by its associated thread while another object emits a signal, this line of code will crash the entire program:

bool receiverInSameThread = receiver->compareThreads();

The problem here is the following: the receiver is half-destroyed and it didn't have any chance to disconnect itself in its own thread (base destructor runs last), but another thread !synchronously! tests the receiver's thread affinity and then even calls receiver->queueSlot() on that half-destroyed object.
This makes the entire activate() method not thread safe.

@agserm
Copy link
Member

agserm commented Jul 1, 2020

Thanks for reporting this, it sounds like you have done a lot of work to track this down. We will investigate and start looking at how to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants