Initialize db_DESTROY return variable

This commit is contained in:
Petr Písař 2014-08-07 18:05:14 +02:00
parent 7587e2d1b9
commit 51e7504338
2 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,4 @@
From d96d40d46bca3c523b1d4d2b580691dc7d8e9802 Mon Sep 17 00:00:00 2001
From d4499d6a6f8007df03fe5292aab4ba0367499dd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 10 Jun 2014 14:28:09 +0200
Subject: [PATCH] Destroy DB_File objects only from original thread context
@ -21,14 +21,14 @@ Closes RT#61912.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
DB_File.xs | 49 ++++++++++++++++++++++++++++++-------------------
DB_File.xs | 50 +++++++++++++++++++++++++++++++-------------------
MANIFEST | 1 +
t/db-threads.t | 46 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+), 19 deletions(-)
3 files changed, 78 insertions(+), 19 deletions(-)
create mode 100644 t/db-threads.t
diff --git a/DB_File.xs b/DB_File.xs
index 679c416..685888e 100755
index 679c416..762f4ed 100755
--- a/DB_File.xs
+++ b/DB_File.xs
@@ -397,6 +397,7 @@ typedef union INFO {
@ -55,7 +55,7 @@ index 679c416..685888e 100755
/* Default to HASH */
RETVAL->filtering = 0 ;
@@ -1571,27 +1574,35 @@ db_DESTROY(db)
@@ -1571,27 +1574,36 @@ db_DESTROY(db)
INIT:
CurrentDB = db ;
Trace(("DESTROY %p\n", db));
@ -77,6 +77,7 @@ index 679c416..685888e 100755
- SvREFCNT_dec(db->filter_store_value) ;
- safefree(db) ;
+ CODE:
+ RETVAL = 0;
+ if (db && db->owner == aTHX) {
+ RETVAL = db_DESTROY(db);
#ifdef DB_VERSION_MAJOR
@ -124,11 +125,11 @@ index e460e81..47f43f7 100644
META.yml Module meta-data (added by MakeMaker)
diff --git a/t/db-threads.t b/t/db-threads.t
new file mode 100644
index 0000000..8987e64
index 0000000..b9f69b6
--- /dev/null
+++ b/t/db-threads.t
@@ -0,0 +1,46 @@
+#!./perl
+#!./perl
+
+use warnings;
+use strict;

View File

@ -1,6 +1,6 @@
Name: perl-DB_File
Version: 1.831
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Perl5 access to Berkeley DB version 1.x
License: GPL+ or Artistic
Group: Development/Libraries
@ -72,6 +72,9 @@ make test
%{_mandir}/man3/*
%changelog
* Thu Aug 07 2014 Petr Pisar <ppisar@redhat.com> - 1.831-4
- Initialize db_DESTROY return variable (bug #1107732)
* Thu Aug 07 2014 Petr Pisar <ppisar@redhat.com> - 1.831-3
- Destroy DB_File objects only from original thread context (bug #1107732)