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

clone mg_ptr for magic #25

Merged
merged 1 commit into from
Jul 19, 2019
Merged

clone mg_ptr for magic #25

merged 1 commit into from
Jul 19, 2019

Conversation

atoomic
Copy link
Collaborator

@atoomic atoomic commented Jul 17, 2019

Handle mg_ptr to avoid to share it with other PVs.

Handle mg_ptr to avoid to share it with other PVs.
@coveralls
Copy link

coveralls commented Jul 17, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling ea428d1 on atoomic:magic into 623c600 on garu:master.

@garu garu merged commit e2ee907 into garu:master Jul 19, 2019
@garu
Copy link
Owner

garu commented Jul 19, 2019

@HaraldJoerg Thank you for reporting!
@atoomic Thank you for fixing!

Clone 0.42 should hit your friendly CPAN mirror any moment now :)

Newxz(mg_ptr, mg->mg_len+1, char); /* add +1 for the NULL at the end? */
Copy(mg->mg_ptr, mg_ptr, mg->mg_len, char);
}
} else if (mg->mg_len == HEf_SVKEY) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that we have no unit tests to cover this part...

/* let's share the SV for now */
SvREFCNT_inc((SV*)mg->mg_ptr);
/* maybe we also want to clone the SV... */
//if (mg_ptr) mg->mg_ptr = (char*) sv_clone((SV*)mg->mg_ptr, hseen, -1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is what we should prefer doing, the current solution above just do one SvRefCnt++

@garu
Copy link
Owner

garu commented Jul 29, 2019

Hey @atoomic! Looks like we broke Geo::Address::Formatter 😱

https://rt.cpan.org/Ticket/Display.html?id=130195

Could you maybe take a look and see if we can fix it? If you have the time, of course!

@atoomic
Copy link
Collaborator Author

atoomic commented Jul 29, 2019 via email

@atoomic
Copy link
Collaborator Author

atoomic commented Jul 29, 2019 via email

@HaraldJoerg
Copy link

While you're at it: I stumbled over another segfault problem when a structure happened to contain a DBI database handle. On Linux, the demo attached dies with Clone 0.41 and Clone 0.42, while it seems to work on Windows.

Cloning database handles is, of course, veeery suspicious (and should not have happened in my code in the first place), but some sort of safeguarding in Clone would be nice.
dbhclone.txt

@atoomic
Copy link
Collaborator Author

atoomic commented Jul 29, 2019 via email

@HaraldJoerg
Copy link

Sure, will report an issue. The relation to #17 is probably just what's given there as a root cause: "Database handles can't be cloned".

@atoomic
Copy link
Collaborator Author

atoomic commented Jul 29, 2019 via email

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

Successfully merging this pull request may close these issues.

4 participants