mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
Fixed UB caused by 0f8e7c18
- avoid storing dangling pointer to lambda
This commit is contained in:
parent
b8e75b87a7
commit
60a6f2a733
@ -331,7 +331,25 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
F& clean;
|
F clean;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CleanupFunction
|
||||||
|
{
|
||||||
|
typedef void Func();
|
||||||
|
|
||||||
|
public:
|
||||||
|
CleanupFunction(Func* clFunc)
|
||||||
|
: clean(clFunc)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
~CleanupFunction()
|
||||||
|
{
|
||||||
|
clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Func* clean;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace Firebird
|
} //namespace Firebird
|
||||||
|
@ -145,7 +145,7 @@ namespace
|
|||||||
#ifndef DEBUG_INIT
|
#ifndef DEBUG_INIT
|
||||||
|
|
||||||
// This instance ensures dtors run when program exits
|
// This instance ensures dtors run when program exits
|
||||||
Firebird::Cleanup global(allClean);
|
Firebird::CleanupFunction global(allClean);
|
||||||
|
|
||||||
#endif //DEBUG_INIT
|
#endif //DEBUG_INIT
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user