Browse Source

Fix race conditions

xuri 5 years ago
parent
commit
cdc57db3b3
2 changed files with 3 additions and 3 deletions
  1. 2 2
      rows.go
  2. 1 1
      xmlWorksheet.go

+ 2 - 2
rows.go

@@ -290,10 +290,10 @@ func (f *File) GetRowHeight(sheet string, row int) (float64, error) {
 // after deserialization of xl/sharedStrings.xml.
 // after deserialization of xl/sharedStrings.xml.
 func (f *File) sharedStringsReader() *xlsxSST {
 func (f *File) sharedStringsReader() *xlsxSST {
 	var err error
 	var err error
-	wbPath := f.getWorkbookPath()
-	relPath := strings.TrimPrefix(filepath.Join(filepath.Dir(wbPath), "_rels", filepath.Base(wbPath)+".rels"), string(filepath.Separator))
 	f.Lock()
 	f.Lock()
 	defer f.Unlock()
 	defer f.Unlock()
+	wbPath := f.getWorkbookPath()
+	relPath := strings.TrimPrefix(filepath.Join(filepath.Dir(wbPath), "_rels", filepath.Base(wbPath)+".rels"), string(filepath.Separator))
 	if f.SharedStrings == nil {
 	if f.SharedStrings == nil {
 		var sharedStrings xlsxSST
 		var sharedStrings xlsxSST
 		ss := f.readXML("xl/sharedStrings.xml")
 		ss := f.readXML("xl/sharedStrings.xml")

+ 1 - 1
xmlWorksheet.go

@@ -313,7 +313,7 @@ type xlsxSheetData struct {
 // xlsxRow directly maps the row element. The element expresses information
 // xlsxRow directly maps the row element. The element expresses information
 // about an entire row of a worksheet, and contains all cell definitions for a
 // about an entire row of a worksheet, and contains all cell definitions for a
 // particular row in the worksheet.
 // particular row in the worksheet.
-type xlsxRow struct { // alignment word
+type xlsxRow struct {
 	C            []xlsxC `xml:"c"`
 	C            []xlsxC `xml:"c"`
 	R            int     `xml:"r,attr,omitempty"`
 	R            int     `xml:"r,attr,omitempty"`
 	Spans        string  `xml:"spans,attr,omitempty"`
 	Spans        string  `xml:"spans,attr,omitempty"`