[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - xmlhelp/source
Michael Stahl
mstahl at redhat.com
Mon Jun 24 05:52:50 PDT 2013
xmlhelp/source/treeview/tvread.cxx | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
New commits:
commit 7ed79c4a3b35a016be6c3d540725512eaf2e0bba
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jun 5 21:27:07 2013 +0200
xmlhelp: fix reading symlinked .tree files
Apparently the .tree files nowadays are symlinked, which was not the
case on the libreoffice-4-0 branch... and on viewing the Contents tab
it's evident we can't actually read symlinked .tree files, and crash
with an STL assert because the children vector is empty.
Change-Id: I5a543ef85b827e194120530a486cf19a76837d87
(cherry picked from commit 3ddf70dc1129e9b2294b582256c657305bbf3b3e)
Reviewed-on: https://gerrit.libreoffice.org/4479
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 83ebfd7..01ef477 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -545,6 +545,11 @@ TVChildTarget::~TVChildTarget()
void TVChildTarget::Check(TVDom* tvDom)
{
+ if (tvDom->children.empty())
+ {
+ return;
+ }
+
unsigned i = 0;
bool h = false;
@@ -807,7 +812,8 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr )
}
osl::Directory aDirectory( url );
- osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileSize | osl_FileStatus_Mask_FileURL );
+ osl::FileStatus aFileStatus(
+ osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL );
if( osl::Directory::E_None == aDirectory.open() )
{
int idx_ = 0;
@@ -831,18 +837,17 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr )
( str[idx_ + 3] == 'e' || str[idx_ + 3] == 'E' ) &&
( str[idx_ + 4] == 'e' || str[idx_ + 4] == 'E' ) )
{
- OSL_ENSURE( aFileStatus.isValid( osl_FileStatus_Mask_FileSize ),
- "invalid file size" );
-
OUString baseName = aFileName.copy(0,idx_).toAsciiLowerCase();
if(! showBasic && baseName.compareToAscii("sbasic") == 0 )
continue;
osl::File aFile( aFileUrl );
if( osl::FileBase::E_None == aFile.open( osl_File_OpenFlag_Read ) )
{
+ // use the file size, not aFileStatus size, in case the
+ // tree file is a symlink
sal_uInt64 nSize;
aFile.getSize( nSize );
- configData.vFileLen.push_back( aFileStatus.getFileSize() );
+ configData.vFileLen.push_back( nSize );
configData.vFileURL.push_back( aFileUrl );
aFile.close();
}
More information about the Libreoffice-commits
mailing list