Skip to content

Commit e8d1eea

Browse files
committed
Fixed segfault at exit() time, CORE-2917
1 parent 21a55b5 commit e8d1eea

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/jrd/trace/TraceConfigStorage.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ ConfigStorage::ConfigStorage()
8484
m_base = NULL;
8585
m_cfg_file = -1;
8686
m_dirty = false;
87+
m_thdId = 0;
8788

8889
PathName filename;
8990
#ifdef WIN_NT
@@ -125,13 +126,14 @@ ConfigStorage::ConfigStorage()
125126
checkFile();
126127
++m_base->cnt_uses;
127128

128-
gds__thread_start(touchThread, (void*) this, THREAD_medium, 0, 0);
129+
gds__thread_start(touchThread, (void*) this, THREAD_medium, 0, &m_thdId);
129130
}
130131

131132
ConfigStorage::~ConfigStorage()
132133
{
133134
// signal touchThread to finish
134135
m_touchSemaphore.release();
136+
THD_wait_for_completion(m_thdId);
135137

136138
::close(m_cfg_file);
137139
m_cfg_file = -1;

src/jrd/trace/TraceConfigStorage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "../../common/classes/init.h"
3434
#include "../../common/classes/semaphore.h"
3535
#include "../../jrd/isc.h"
36-
#include "../../jrd/ThreadData.h"
36+
#include "../../jrd/ThreadStart.h"
3737
#include "../../jrd/trace/TraceSession.h"
3838

3939
namespace Jrd {
@@ -126,6 +126,7 @@ friend class StorageInstance;
126126
int m_cfg_file;
127127
bool m_dirty;
128128
Firebird::Semaphore m_touchSemaphore;
129+
ThreadHandle m_thdId;
129130
};
130131

131132

0 commit comments

Comments
 (0)