Skip to content

Commit df7248a

Browse files
committed
cant destroy complex global variables at shutdown 180?
1 parent c72895f commit df7248a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

db/dur_recover.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,10 @@ namespace mongo {
185185
}
186186

187187
RecoveryJob::~RecoveryJob() {
188-
if( !_mmfs.empty() )
189-
close();
188+
DESTRUCTOR_GUARD(
189+
if( !_mmfs.empty() )
190+
close();
191+
)
190192
}
191193

192194
void RecoveryJob::close() {
@@ -444,8 +446,8 @@ namespace mongo {
444446
}
445447
} brunittest;
446448

447-
448-
RecoveryJob RecoveryJob::_instance;
449+
// can't free at termination because order of destruction of global vars is arbitrary
450+
RecoveryJob &RecoveryJob::_instance = *(new RecoveryJob());
449451

450452
} // namespace dur
451453

db/dur_recover.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace mongo {
3939

4040
bool _recovering; // are we in recovery or WRITETODATAFILES
4141

42-
static RecoveryJob _instance;
42+
static RecoveryJob &_instance;
4343
};
4444
}
4545
}

0 commit comments

Comments
 (0)