Closed alevesely closed 3 months ago
È sufficiente mettere extern
:
Index: cie-pkcs11/LOGGER/Logger.cpp
===================================================================
--- cie-pkcs11/LOGGER/Logger.cpp (revision 89)
+++ cie-pkcs11/LOGGER/Logger.cpp (working copy)
@@ -122,7 +122,7 @@
}
int log_level = m_Instance->getLogConfig();
- printf("Lib log level: %d\n", log_level);
+ // printf("Lib log level: %d\n", log_level);
if (log_level == LOG_STATUS_DISABLED) {
m_Instance->disableLog();
Index: cie-pkcs11/Util/defines.h
===================================================================
--- cie-pkcs11/Util/defines.h (revision 89)
+++ cie-pkcs11/Util/defines.h (working copy)
@@ -54,7 +54,7 @@
#define logParamBuf(p,l)
#define logParamBufHide(p,l)
-CLog Log;
+extern CLog Log;
#define init_func \
CFuncCallInfo info(__FUNCTION__ ,Log);
//OutputDebugString(fName);
Index: cie-pkcs11/Util/log.cpp
===================================================================
--- cie-pkcs11/Util/log.cpp (revision 89)
+++ cie-pkcs11/Util/log.cpp (working copy)
@@ -39,6 +39,8 @@
LM_Module_Thread // un file per modulo e per thread
} LogMode = LM_Module;
+// definition
+CLog Log;
void initLog(const char *moduleName, const char *iniFile,const char *version)
{
Index: cie_sign_sdk/src/PCSC/APDU.h
===================================================================
--- cie_sign_sdk/src/PCSC/APDU.h (revision 89)
+++ cie_sign_sdk/src/PCSC/APDU.h (working copy)
@@ -1,5 +1,6 @@
#pragma once
#include <functional>
+#include <cstdint>
class CToken;
class APDU
Questo problema causa anche sistematici crash all'uscita da diverse applicazioni che caricano la libreria libcie-pkcs11.so
, fra cui LibreOffice e Okular: ho descritto nel dettaglio il problema su Forum Italia.
Non è quindi una combinazione se il problema è apparso con la release 1.4.2, che includeva proprio delle migliorie alla gestione dei log come descritto nella issue #27 .
Risolta nella 1.4.3.9
Eseguendo il test, anche dando 20 come primo input, il programma esce abortendo a causa di un
double free
. Si tratta diCLog::~CLog()
come si vede lanciando il test sotto gdb:In effetti, la definizione
CLog Log;
è stata spostata indefines.h
. Non mi è chiaro se gcc tenta di considerarlo un unico oggetto.Forse dovrebbe essere dichiarato
static
cosicché ognuno abbia la sua copia di Log, oppure costruirlo come singleton in modo da condividere un'unica copia.Peraltro, c'è un altro
log.cpp
incie_sign_sdk/src/Util
, leggermente diverso. C'è una ragione per tenerne due copie?Già che ci sono, posso chiedere se questo repository viene usato anche per WIN32?