diff options
author | Matthias Huetsch [mhu] <matthias.huetsch@sun.com> | 2010-03-04 15:19:41 +0100 |
---|---|---|
committer | Matthias Huetsch [mhu] <matthias.huetsch@sun.com> | 2010-03-04 15:19:41 +0100 |
commit | 709ee7e9b098fa7074d84d3faab7aa5cd5ebf73b (patch) | |
tree | d58e2e95e278a2c864877950904c7bc27dbe3e41 /idlc | |
parent | ffca8743e16d5afd101df88aa50f2c8735830e53 (diff) |
mhu22: #i105430# #i108349# Fixed registry:ORegKey reference counting to avoid redundant closeKey()/flush() calls.
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/source/astdump.cxx | 4 | ||||
-rw-r--r-- | idlc/source/idlcproduce.cxx | 22 |
2 files changed, 11 insertions, 15 deletions
diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx index d9c51b567e2a..217616b60198 100644 --- a/idlc/source/astdump.cxx +++ b/idlc/source/astdump.cxx @@ -137,6 +137,10 @@ sal_Bool AstModule::dump(RegistryKey& rKey) } } } + if ( getNodeType() == NT_root ) + { + localKey.releaseKey(); + } return AstDeclaration::dump(rKey); } diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index b0c84239c83d..75007ecc9b91 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -149,11 +149,11 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) return 1; } - Registry regFile; - removeIfExists(regTmpName); OString urlRegTmpName = convertToFileUrl(regTmpName); - if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) ) + + Registry regFile; + if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) != REG_NO_ERROR ) { fprintf(stderr, "%s: could not create registry file '%s'\n", pOptions->getProgramName().getStr(), regTmpName.getStr()); @@ -164,7 +164,7 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) } RegistryKey rootKey; - if ( regFile.openRootKey(rootKey) ) + if ( regFile.openRootKey(rootKey) != REG_NO_ERROR ) { fprintf(stderr, "%s: could not open root of registry file '%s'\n", pOptions->getProgramName().getStr(), regFileName.getStr()); @@ -177,7 +177,7 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) // produce registry file if ( !idlc()->getRoot()->dump(rootKey) ) { - rootKey.closeKey(); + rootKey.releaseKey(); regFile.close(); regFile.destroy(OStringToOUString(regFileName, RTL_TEXTENCODING_UTF8)); removeIfExists(regFileName); @@ -185,16 +185,8 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) return 1; } - if ( rootKey.closeKey() ) - { - fprintf(stderr, "%s: could not close root of registry file '%s'\n", - pOptions->getProgramName().getStr(), regFileName.getStr()); - removeIfExists(regTmpName); - removeIfExists(regFileName); - cleanPath(); - return 1; - } - if ( regFile.close() ) + rootKey.releaseKey(); + if ( regFile.close() != REG_NO_ERROR ) { fprintf(stderr, "%s: could not close registry file '%s'\n", pOptions->getProgramName().getStr(), regFileName.getStr()); |