[Libreoffice-commits] .: 10 commits - connectivity/source idlc/inc idlc/source solenv/gbuild sw/source

Michael Stahl mst at kemper.freedesktop.org
Sat Jan 14 12:28:43 PST 2012


 connectivity/source/drivers/dbase/dindexnode.cxx |   21 ++-
 idlc/inc/idlc/idlc.hxx                           |   12 +-
 idlc/source/idlc.cxx                             |   57 +++++++++
 idlc/source/idlccompile.cxx                      |    2 
 idlc/source/idlcmain.cxx                         |   47 +++++---
 idlc/source/idlcproduce.cxx                      |   46 +++++++
 idlc/source/options.cxx                          |   16 ++
 idlc/source/scanner.ll                           |    2 
 solenv/gbuild/TargetLocations.mk                 |    1 
 solenv/gbuild/UnoApiTarget.mk                    |  135 ++++++++++++++++-------
 sw/source/ui/uno/unotxdoc.cxx                    |    3 
 11 files changed, 273 insertions(+), 69 deletions(-)

New commits:
commit e48b14ed3b24fa1d9f0aeb0670b79e529638a6b1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:19:41 2012 +0100

    gbuild: UnoApiTarget: just touch the .urd file
    
    Apparently the peculiarity that a non-existent file is newer than an
    existing file is in GNU make 3.82, but not 3.81.

diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index 08d34e7..426d967 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -193,11 +193,10 @@ $(call gb_UnoApiTarget_get_clean_target,%) :
 # rule plus the dependency from the .done target to the .urd file plus the
 # sort/patsubst call in gb_UnoApiPartTarget__command cause command to be
 # invoked with the .idl file corresponding to the .urd in that case.
-# Yes, this command removes the target.  This is because it works.  The
-# command "true" does not work.  Apparently make considers a file that does
-# not exist as newer than the target.  Which is weird.  But there you go.
+# Touch the .urd file, so it is newer than the .done file, causing that to
+# be rebuilt and overwriting the .urd file again.
 $(call gb_UnoApiPartTarget_get_target,%.urd) :
-	@rm -f $@
+	mkdir -p $(dir $@) && touch $@
 
 $(call gb_UnoApiPartTarget_get_target,%.done) :
 	$(call gb_UnoApiPartTarget__command,$@,$*,$?)
commit 9738ad3e6b85fad280cdf03b188585cdce9817a5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:19:36 2012 +0100

    gbuild: UnoApiTarget: use idlc -M for full dependencies

diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 65a8c75..58b581a 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -205,6 +205,7 @@ $(eval $(call gb_Helper_make_dep_targets,\
 	SrsPartTarget \
 	SrsTarget \
 	UnoApiTarget \
+	UnoApiPartTarget \
 ))
 
 # other getters
diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index 0a32498..08d34e7 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -59,6 +59,9 @@ $(call gb_UnoApiOutTarget_get_target,$(1)) : $(call gb_UnoApiTarget_get_target,$
 $(call gb_UnoApiOutTarget_get_clean_target,$(1)) : $(call gb_UnoApiTarget_get_clean_target,$(1))
 gb_UnoApiTarget_HPPFILES_$(1) :=
 gb_UnoApiTarget_IDLFILES_$(1) :=
+ifeq ($(gb_FULLDEPS),$(true))
+-include $(call gb_UnoApiTarget_get_dep_target,$(1))
+endif
 
 endef
 
@@ -67,6 +70,13 @@ $(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
 	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
 
+ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_UnoApiTarget_get_dep_target,$(1)) : \
+       $(call gb_UnoApiPartTarget_get_dep_target,$(2)/$(3))
+$(call gb_UnoApiPartTarget_get_dep_target,$(2)/$(3)) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done)
+endif
+
 endef
 
 define gb_UnoApiTarget__add_idlfiles
@@ -169,8 +179,10 @@ $(call gb_UnoApiOutTarget_get_clean_target,%) :
 $(call gb_UnoApiTarget_get_clean_target,%) :
 	$(call gb_Output_announce,$*,$(false),UNO,1)
 	-$(call gb_Helper_abbreviate_dirs,\
-		rm -f $(call gb_UnoApiTarget_get_target,$*)) 
+		rm -f $(call gb_UnoApiTarget_get_target,$*))
 	-rm -rf $(call gb_UnoApiTarget_get_header_target,$*)\
+			$(call gb_UnoApiTarget_get_dep_target,$*) \
+			$(basename $(call gb_UnoApiPartTarget_get_dep_target,$*)) \
 			$(call gb_UnoApiPartTarget_get_target,$*)
 
 # The .urd files are actually created by the gb_UnoApiPartTarget__command,
@@ -181,8 +193,11 @@ $(call gb_UnoApiTarget_get_clean_target,%) :
 # rule plus the dependency from the .done target to the .urd file plus the
 # sort/patsubst call in gb_UnoApiPartTarget__command cause command to be
 # invoked with the .idl file corresponding to the .urd in that case.
+# Yes, this command removes the target.  This is because it works.  The
+# command "true" does not work.  Apparently make considers a file that does
+# not exist as newer than the target.  Which is weird.  But there you go.
 $(call gb_UnoApiPartTarget_get_target,%.urd) :
-	@true
+	@rm -f $@
 
 $(call gb_UnoApiPartTarget_get_target,%.done) :
 	$(call gb_UnoApiPartTarget__command,$@,$*,$?)
@@ -193,6 +208,7 @@ define gb_UnoApiPartTarget__command
 	mkdir -p $(call gb_UnoApiPartTarget_get_target,$(dir $(2))) && \
 	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,\
 		$(call gb_Helper_convert_native,$(INCLUDE) $(DEFS) \
+		-M $(basename $(call gb_UnoApiPartTarget_get_dep_target,$(dir $(2)))) \
 		-O $(call gb_UnoApiPartTarget_get_target,$(dir $(2))) -verbose -C \
 		$(sort $(patsubst $(call gb_UnoApiPartTarget_get_target,%.urd),$(SRCDIR)/%.idl,$(3))))) && \
 	$(gb_UnoApiTarget_IDLCCOMMAND) @$${RESPONSEFILE} > /dev/null && \
@@ -222,9 +238,30 @@ $(call gb_Helper_abbreviate_dirs_native,\
 
 endef
 
+# cat the deps of all IDLs in one file, then we need only open that one file
+define gb_UnoApiTarget__command_dep
+$(call gb_Output_announce,IDL:$(2),$(true),DEP,1)
+$(call gb_Helper_abbreviate_dirs,\
+	mkdir -p $(dir $(1)) && \
+	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
+		$(foreach idl,$(patsubst %.idl,%,$(3)),$(call gb_UnoApiPartTarget_get_dep_target,$(idl)))) && \
+	$(SOLARENV)/bin/concat-deps $${RESPONSEFILE} > $(1)) && \
+	rm -f $${RESPONSEFILE}
+
+endef
+
+ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_UnoApiPartTarget_get_dep_target,%) :
+	$(if $(realpath $@),touch $@,\
+	  $(call gb_Object__command_dep,$@,$(call gb_UnoApiPartTarget_get_target,$*.urd)))
+
+$(call gb_UnoApiTarget_get_dep_target,%) : $(call gb_UnoApiTarget_get_target,%)
+	$(call gb_UnoApiTarget__command_dep,$@,$*,$(gb_UnoApiTarget_IDLFILES_$*))
+
+endif
+
 # TODO:
 # - get idlc switch "-P" (generate .urd into package dir)
-# - generate dependencies for included idls
 # - empty $? in headertarget?
 
 $(call gb_UnoApiTarget_get_target,%):
commit 140d990b434de980f4f1e97d3e0d647231202183
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:16:50 2012 +0100

    gbuild: UnoApiTarget: refactor to one idlc call per directory

diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index 4d0f7e2..0a32498 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -62,9 +62,14 @@ gb_UnoApiTarget_IDLFILES_$(1) :=
 
 endef
 
-define gb_UnoApiTarget_add_idlfiles
-$(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile,$(1),$(2),$(idl)))
+define gb_UnoApiTarget__add_idlfile
+$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
+gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
+
+endef
 
+define gb_UnoApiTarget__add_idlfiles
 $(call gb_UnoApiTarget_get_target,$(1)) : \
 	$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done)
 $(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
@@ -72,58 +77,52 @@ $(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
 
 endef
 
+define gb_UnoApiTarget_add_idlfiles
+$(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile,$(1),$(2),$(idl)))
+$(call gb_UnoApiTarget__add_idlfiles,$(1),$(2),$(3))
+
+endef
+
 # for interfaces, exceptions, structs, enums, constant groups
 define gb_UnoApiTarget_add_idlfile
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hdl $(2)/$(3).hpp
-gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
 
 $(call gb_UnoApiTarget_get_header_target,$(2)/$(3).hpp) :| \
 	$(call gb_UnoApiTarget_get_target,$(1))
 $(call gb_UnoApiTarget_get_header_target,$(2)/$(3).hdl) :| \
 	$(call gb_UnoApiTarget_get_target,$(1))
 
+$(call gb_UnoApiTarget__add_idlfile,$(1),$(2),$(3))
+
 endef
 
 define gb_UnoApiTarget_add_idlfiles_noheader
 $(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile_noheader,$(1),$(2),$(idl)))
-
-$(call gb_UnoApiTarget_get_target,$(1)) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done)
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done) : \
-	$(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
+$(call gb_UnoApiTarget__add_idlfiles,$(1),$(2),$(3))
 
 endef
 
 # for old-style services and modules
 define gb_UnoApiTarget_add_idlfile_noheader
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
-gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
+$(call gb_UnoApiTarget__add_idlfile,$(1),$(2),$(3))
 
 endef
 
 define gb_UnoApiTarget_add_idlfiles_nohdl
 $(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile_nohdl,$(1),$(2),$(idl)))
-
-$(call gb_UnoApiTarget_get_target,$(1)) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done)
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done) : \
-	$(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
+$(call gb_UnoApiTarget__add_idlfiles,$(1),$(2),$(3))
 
 endef
 
 # for new-style services
 define gb_UnoApiTarget_add_idlfile_nohdl
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hpp
-gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
 
 $(call gb_UnoApiTarget_get_header_target,$(2)/$(3).hpp) :| \
 	$(call gb_UnoApiTarget_get_target,$(1))
 
+$(call gb_UnoApiTarget__add_idlfile,$(1),$(2),$(3))
+
 endef
 
 define gb_UnoApiTarget_add_rdbfiles
commit 101791f57c7f1b6f5feae751b77641a9d5f2187a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:16:23 2012 +0100

    idlc: do not use -I., deps need absolute paths

diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 72806d9..f83820f 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -252,7 +252,7 @@ sal_Int32 compileFile(const OString * pathname)
     idlc()->setRealFileName(tmpFile);
 
     OStringBuffer cppArgs(512);
-    cppArgs.append("-DIDL -Xi -Xc -+ -I.");
+    cppArgs.append("-DIDL -Xi -Xc -+");
     Options* pOptions = idlc()->getOptions();
 
     OString filePath;
commit b83fd45150a411a2f8e8b621e844029d83c12473
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:16:17 2012 +0100

    idlc: new parameter -M: write GNU make dependencies

diff --git a/idlc/inc/idlc/idlc.hxx b/idlc/inc/idlc/idlc.hxx
index 8262b26..0bd4c2f 100644
--- a/idlc/inc/idlc/idlc.hxx
+++ b/idlc/inc/idlc/idlc.hxx
@@ -54,6 +54,9 @@ public:
 
     void init();
 
+    bool dumpDeps(::rtl::OString const& rDepFile,
+                  ::rtl::OString const& rTarget);
+
     Options* getOptions()
         { return m_pOptions; }
     AstStack* scopes()
@@ -65,7 +68,7 @@ public:
     const ::rtl::OString& getFileName()
         { return m_fileName; }
     void setFileName(const ::rtl::OString& fileName)
-        { m_fileName = fileName; }
+        { m_fileName = fileName; addInclude(fileName); }
     const ::rtl::OString& getMainFileName()
         { return m_mainFileName; }
     void setMainFileName(const ::rtl::OString& mainFileName)
@@ -118,7 +121,7 @@ public:
     void setParseState(ParseState parseState)
         { m_parseState = parseState; }
 
-    void insertInclude(const ::rtl::OString& inc)
+    void addInclude(const ::rtl::OString& inc)
         { m_includes.insert(inc); }
     StringSet* getIncludes()
         { return &m_includes; }
@@ -149,9 +152,12 @@ private:
     StringSet           m_includes;
 };
 
+
+typedef ::std::pair< ::rtl::OString const&, ::rtl::OString const& > sPair_t;
 sal_Int32 compileFile(const ::rtl::OString * pathname);
     // a null pathname means stdin
-sal_Int32 produceFile(const ::rtl::OString& filenameBase);
+sal_Int32 produceFile(const ::rtl::OString& filenameBase,
+        sPair_t const*const pDepFile);
     // filenameBase is filename without ".idl"
 void removeIfExists(const ::rtl::OString& pathname);
 
diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index c963287..449de35 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -44,7 +44,9 @@
 #include "idlc/asttype.hxx"
 #include "idlc/asttypedef.hxx"
 
-#include "osl/diagnose.h"
+#include <osl/diagnose.h>
+#include <osl/file.hxx>
+#include <osl/thread.h>
 
 using namespace ::rtl;
 
@@ -286,6 +288,59 @@ sal_Bool Idlc::isDocValid()
     return sal_False;;
 }
 
+static void lcl_writeString(::osl::File & rFile, ::osl::FileBase::RC & o_rRC,
+        ::rtl::OString const& rString)
+{
+    sal_uInt64 nWritten(0);
+    if (::osl::FileBase::E_None == o_rRC) {
+        o_rRC = rFile.write(rString.getStr(), rString.getLength(), nWritten);
+        if (static_cast<sal_uInt64>(rString.getLength()) != nWritten) {
+            o_rRC = ::osl::FileBase::E_INVAL; //?
+        }
+    }
+}
+
+struct WriteDep
+{
+    ::osl::File& m_rFile;
+    ::osl::FileBase::RC & m_rRC;
+    explicit WriteDep(::osl::File & rFile, ::osl::FileBase::RC & rRC)
+        : m_rFile(rFile), m_rRC(rRC) { }
+    void operator() (::rtl::OString const& rEntry)
+    {
+        lcl_writeString(m_rFile, m_rRC, " \\\n ");
+        lcl_writeString(m_rFile, m_rRC, rEntry);
+    }
+};
+
+bool
+Idlc::dumpDeps(::rtl::OString const& rDepFile, ::rtl::OString const& rTarget)
+{
+    ::osl::File depFile(
+            ::rtl::OStringToOUString(rDepFile, osl_getThreadTextEncoding()));
+    ::osl::FileBase::RC rc =
+        depFile.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create);
+    if (::osl::FileBase::E_None != rc) {
+        return false;
+    }
+    lcl_writeString(depFile, rc, rTarget);
+    if (::osl::FileBase::E_None != rc) {
+        return false;
+    }
+    lcl_writeString(depFile, rc, " :");
+    if (::osl::FileBase::E_None != rc) {
+        return false;
+    }
+    m_includes.erase(getRealFileName()); // eeek, that is a temp file...
+    ::std::for_each(m_includes.begin(), m_includes.end(),
+            WriteDep(depFile, rc));
+    if (::osl::FileBase::E_None != rc) {
+        return false;
+    }
+    rc = depFile.close();
+    return ::osl::FileBase::E_None == rc;
+}
+
 static Idlc* pStaticIdlc = NULL;
 
 Idlc* SAL_CALL idlc()
diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx
index f9faa7e..399fd6f 100644
--- a/idlc/source/idlcmain.cxx
+++ b/idlc/source/idlcmain.cxx
@@ -86,7 +86,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         if (nErrors > 0) {
             removeIfExists(outputUrl);
         } else {
-            nErrors = produceFile(outputUrl);
+            nErrors = produceFile(outputUrl, 0);
         }
         idlc()->reset();
     }
@@ -115,26 +115,43 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
                     (*i).getStr());
 
         // prepare output file name
-        OString outputFileUrl;
+        OString const strippedFileName(
+                sysFileName.copy(sysFileName.lastIndexOf(SEPARATOR) + 1));
+        OString outputFile;
         if ( options.isValid("-O") )
         {
-            OString strippedFileName(sysFileName.copy(sysFileName.lastIndexOf(SEPARATOR) + 1));
-            outputFileUrl = convertToFileUrl(options.getOption("-O"));
-            sal_Char c = outputFileUrl.getStr()[outputFileUrl.getLength()-1];
-
-            if ( c != '/' )
-                outputFileUrl += OString::valueOf('/');
+            outputFile = (options.getOption("-O"));
+            if ('/' != outputFile.getStr()[outputFile.getLength()-1]) {
+                outputFile += OString::valueOf('/');
+            }
+            outputFile += strippedFileName.replaceAt(
+                    strippedFileName.getLength() -3 , 3, "urd");
+        } else {
+            outputFile =
+                sysFileName.replaceAt(sysFileName.getLength() -3 , 3, "urd");
+        }
+        OString const outputFileUrl = convertToFileUrl(outputFile);
 
-            outputFileUrl += strippedFileName.replaceAt(strippedFileName.getLength() -3 , 3, "urd");
-        } else
-        {
-            outputFileUrl = convertToFileUrl(sysFileName.replaceAt(sysFileName.getLength() -3 , 3, "urd"));
+        ::rtl::OString depFileUrl;
+        if (options.isValid("-M")) {
+            depFileUrl = convertToFileUrl(options.getOption("-M"));
+            if ('/' != depFileUrl.getStr()[depFileUrl.getLength()-1]) {
+                depFileUrl += OString::valueOf('/');
+            }
+            depFileUrl += strippedFileName.replaceAt(
+                    strippedFileName.getLength() -3 , 3, "d");
         }
 
-        if ( nErrors )
+        if ( nErrors ) {
+            if (options.isValid("-M")) {
+                removeIfExists(depFileUrl);
+            }
             removeIfExists(outputFileUrl);
-        else
-            nErrors = produceFile(outputFileUrl);
+        } else {
+            sPair_t const pair(depFileUrl, outputFile);
+            nErrors = produceFile(outputFileUrl,
+                        (options.isValid("-M")) ? &pair : 0);
+        }
 
         idlc()->reset();
     }
diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx
index 04ee34f..f4ca2d9 100644
--- a/idlc/source/idlcproduce.cxx
+++ b/idlc/source/idlcproduce.cxx
@@ -132,7 +132,8 @@ void removeIfExists(const OString& pathname)
     unlink(pathname.getStr());
 }
 
-sal_Int32 SAL_CALL produceFile(const OString& regFileName)
+sal_Int32 SAL_CALL
+produceFile(const OString& regFileName, sPair_t const*const pDepFile)
 {
     Options* pOptions = idlc()->getOptions();
 
@@ -145,6 +146,20 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName)
         return 1;
     }
 
+    OString depTmpName;
+    if (pDepFile)
+    {
+        depTmpName = pDepFile->first.replaceAt(
+                        regFileName.getLength() -3, 3, "_idlc_");
+        if ( !checkOutputPath(depTmpName) )
+        {
+            fprintf(stderr, "%s: could not create path of dep file '%s'.\n",
+                pOptions->getProgramName().getStr(), pDepFile->first.getStr());
+            return 1;
+        }
+        removeIfExists(depTmpName);
+    }
+
     removeIfExists(regTmpName);
     OString urlRegTmpName = convertToFileUrl(regTmpName);
 
@@ -192,6 +207,18 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName)
         return 1;
     }
 
+    if (pDepFile && !idlc()->dumpDeps(depTmpName, pDepFile->second))
+    {
+        fprintf(stderr, "%s: could not write dep file '%s'\n",
+                pOptions->getProgramName().getStr(), pDepFile->first.getStr());
+        removeIfExists(depTmpName);
+        removeIfExists(pDepFile->first);
+        removeIfExists(regTmpName);
+        removeIfExists(regFileName);
+        cleanPath();
+        return 1;
+    }
+
     removeIfExists(regFileName);
 
     if ( File::move(OStringToOUString(regTmpName, osl_getThreadTextEncoding()),
@@ -205,6 +232,23 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName)
     }
     removeIfExists(regTmpName);
 
+    if (pDepFile)
+    {
+        removeIfExists(pDepFile->first);
+        if ( File::move(OStringToOUString(depTmpName, osl_getThreadTextEncoding()),
+                        OStringToOUString(pDepFile->first, osl_getThreadTextEncoding())) != FileBase::E_None ) {
+            fprintf(stderr, "%s: cannot rename dep file '%s' to '%s'\n",
+                    idlc()->getOptions()->getProgramName().getStr(),
+                    depTmpName.getStr(), pDepFile->first.getStr());
+            removeIfExists(depTmpName);
+            removeIfExists(pDepFile->first);
+            removeIfExists(regFileName);
+            cleanPath();
+            return 1;
+        }
+        removeIfExists(depTmpName);
+    }
+
     return 0;
 }
 
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx
index f6f8c6b..b30a4ed 100644
--- a/idlc/source/options.cxx
+++ b/idlc/source/options.cxx
@@ -76,6 +76,7 @@ bool Options::checkArgument (std::vector< std::string > & rArgs, char const * ar
         switch (arg[1])
         {
         case 'O':
+        case 'M':
         case 'I':
         case 'D':
           {
@@ -214,6 +215,16 @@ bool Options::initOptions(std::vector< std::string > & rArgs) throw(IllegalArgum
         m_options["-O"] = param;
         break;
       }
+    case 'M':
+      {
+        if (!((++first != last) && ((*first)[0] != '-')))
+        {
+          return badOption("invalid", option);
+        }
+        OString param((*first).c_str(), (*first).size());
+        m_options["-M"] = param;
+        break;
+      }
     case 'I':
       {
         if (!((++first != last) && ((*first)[0] != '-')))
@@ -344,6 +355,9 @@ OString Options::prepareHelp()
     help += "                  The generated output is a registry file with\n";
     help += "                  the same name as the idl input file (or 'stdin'\n";
     help += "                  for -stdin).\n";
+    help += "    -M<path>    = path specifies the output directory for deps.\n";
+    help += "                  Generate GNU make dependency files with the\n";
+    help += "                  same name as the idl input file.\n";
     help += "    -I<path>    = path specifies a directory where include\n";
     help += "                  files will be searched by the preprocessor.\n";
     help += "                  Multiple directories can be combined with ';'.\n";
diff --git a/idlc/source/scanner.ll b/idlc/source/scanner.ll
index 2206297..1fdbeab 100644
--- a/idlc/source/scanner.ll
+++ b/idlc/source/scanner.ll
@@ -215,7 +215,7 @@ static void	idlParsePragma(sal_Char* pPragma)
 	sal_Char* offset = begin;
 	while (*offset != ',') offset++;
 	//::rtl::OString include = pragma.copy(index + 8, offset - begin);
-	idlc()->insertInclude(pragma.copy(index + 8, (sal_Int32)(offset - begin)));
+	//unused// idlc()->insertInclude(pragma.copy(index + 8, (sal_Int32)(offset - begin)));
 }	
 
 static void parseLineAndFile(sal_Char* pBuf)
commit 67ae80657a053626df5186983ae6b6f20b90e52e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:01:11 2012 +0100

    idlc: document all parameters

diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx
index 5b2c7cb..f6f8c6b 100644
--- a/idlc/source/options.cxx
+++ b/idlc/source/options.cxx
@@ -352,6 +352,8 @@ OString Options::prepareHelp()
     help += "                  documentation.\n";
     help += "    -cid        = check if identifiers fulfill the UNO naming\n";
     help += "                  requirements.\n";
+    help += "    -quiet      = no output.\n";
+    help += "    -verbose    = verbose output.\n";
     help += "    -w          = display warning messages.\n";
     help += "    -we         = treat warnings as errors.\n";
     help += "    -h|-?       = print this help message and exit.\n\n";
commit 12d6fe95ae25e22d627dc45e37fae91da4cfa54d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:01:11 2012 +0100

    gbuild: UnoApiTarget: various cleanups

diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index e557577..4d0f7e2 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -46,7 +46,6 @@ $(call gb_Package_get_target,$(1)_inc) : $(call gb_UnoApiTarget_get_target,$(1))
 
 endef
 
-# TODO: make multi repo safe
 define gb_UnoApiTarget_autopackage_idl
 $$(eval $$(call gb_Package_Package,$(1)_idl,$(SRCDIR)))
 $(foreach onefile,$(gb_UnoApiTarget_IDLFILES_$(1)), \
@@ -54,9 +53,6 @@ $(foreach onefile,$(gb_UnoApiTarget_IDLFILES_$(1)), \
 
 endef
 
-$(call gb_UnoApiTarget_get_header_target,$(1))/% : $(call gb_UnoApiTarget_get_target,$(1))
-	mkdir -p $$(dir $$@)
-
 define gb_UnoApiTarget_UnoApiTarget
 $$(eval $$(call gb_Module_register_target,$(call gb_UnoApiOutTarget_get_target,$(1)),$(call gb_UnoApiOutTarget_get_clean_target,$(1))))
 $(call gb_UnoApiOutTarget_get_target,$(1)) : $(call gb_UnoApiTarget_get_target,$(1))
@@ -69,38 +65,39 @@ endef
 define gb_UnoApiTarget_add_idlfiles
 $(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile,$(1),$(2),$(idl)))
 
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : $(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
-	$(gb_UnoApiPartTarget__command)
+$(call gb_UnoApiTarget_get_target,$(1)) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done)
+$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
+	$(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
 
 endef
 
 # for interfaces, exceptions, structs, enums, constant groups
 define gb_UnoApiTarget_add_idlfile
-$(call gb_UnoApiTarget_get_target,$(1)) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done)
 $(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
 	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
-gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hdl
-gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hpp
+gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hdl $(2)/$(3).hpp
 gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
 
-$(call gb_UnoApiTarget_get_header_target,)$(2)/$(3).hpp :| $(call gb_UnoApiTarget_get_target,$(1))
-$(call gb_UnoApiTarget_get_header_target,)$(2)/$(3).hdl :| $(call gb_UnoApiTarget_get_target,$(1))
+$(call gb_UnoApiTarget_get_header_target,$(2)/$(3).hpp) :| \
+	$(call gb_UnoApiTarget_get_target,$(1))
+$(call gb_UnoApiTarget_get_header_target,$(2)/$(3).hdl) :| \
+	$(call gb_UnoApiTarget_get_target,$(1))
 
 endef
 
 define gb_UnoApiTarget_add_idlfiles_noheader
 $(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile_noheader,$(1),$(2),$(idl)))
 
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done) : $(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
-	$(gb_UnoApiPartTarget__command)
+$(call gb_UnoApiTarget_get_target,$(1)) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done)
+$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done) : \
+	$(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
 
 endef
 
 # for old-style services and modules
 define gb_UnoApiTarget_add_idlfile_noheader
-$(call gb_UnoApiTarget_get_target,$(1)) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done)
 $(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done) : \
 	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
@@ -110,21 +107,22 @@ endef
 define gb_UnoApiTarget_add_idlfiles_nohdl
 $(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile_nohdl,$(1),$(2),$(idl)))
 
-$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done) : $(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
-	$(gb_UnoApiPartTarget__command)
+$(call gb_UnoApiTarget_get_target,$(1)) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done)
+$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done) : \
+	$(foreach idl,$(3),$(SRCDIR)/$(2)/$(idl).idl)
 
 endef
 
 # for new-style services
 define gb_UnoApiTarget_add_idlfile_nohdl
-$(call gb_UnoApiTarget_get_target,$(1)) : \
-	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done)
 $(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done) : \
 	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hpp
 gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
 
-$(call gb_UnoApiTarget_get_header_target,)$(2)/$(3).hpp :| $(call gb_UnoApiTarget_get_target,$(1))
+$(call gb_UnoApiTarget_get_header_target,$(2)/$(3).hpp) :| \
+	$(call gb_UnoApiTarget_get_target,$(1))
 
 endef
 
@@ -166,7 +164,7 @@ endef
 $(call gb_UnoApiOutTarget_get_clean_target,%) :
 	$(call gb_Output_announce,$*,$(false),UNO,1)
 	-$(call gb_Helper_abbreviate_dirs,\
-		rm -f $(call gb_UnoApiOutTarget_get_target,$*)) 
+		rm -f $(call gb_UnoApiOutTarget_get_target,$*))
 
 .PHONY : $(call gb_UnoApiTarget_get_clean_target,%)
 $(call gb_UnoApiTarget_get_clean_target,%) :
@@ -187,15 +185,20 @@ $(call gb_UnoApiTarget_get_clean_target,%) :
 $(call gb_UnoApiPartTarget_get_target,%.urd) :
 	@true
 
+$(call gb_UnoApiPartTarget_get_target,%.done) :
+	$(call gb_UnoApiPartTarget__command,$@,$*,$?)
+
+
 define gb_UnoApiPartTarget__command
-	$$(call gb_Output_announce,$(2),$(true),IDL,2)
-	mkdir -p $(call gb_UnoApiPartTarget_get_target,$(2)) && \
-	RESPONSEFILE=$$(call var2file,$$(shell $(gb_MKTEMP)),500,\
-		$$(call gb_Helper_convert_native,$$(INCLUDE) $$(DEFS) -O $(call gb_UnoApiPartTarget_get_target,$(2)) -verbose -C \
-		$$(sort $$(patsubst $$(call gb_UnoApiPartTarget_get_target,%.urd),$(SRCDIR)/%.idl,$$?)))) && \
-	$(gb_UnoApiTarget_IDLCCOMMAND) @$$$${RESPONSEFILE} > /dev/null && \
-	rm -f $$$${RESPONSEFILE} && \
-	touch $$@
+	$(call gb_Output_announce,$(2),$(true),IDL,2)
+	mkdir -p $(call gb_UnoApiPartTarget_get_target,$(dir $(2))) && \
+	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,\
+		$(call gb_Helper_convert_native,$(INCLUDE) $(DEFS) \
+		-O $(call gb_UnoApiPartTarget_get_target,$(dir $(2))) -verbose -C \
+		$(sort $(patsubst $(call gb_UnoApiPartTarget_get_target,%.urd),$(SRCDIR)/%.idl,$(3))))) && \
+	$(gb_UnoApiTarget_IDLCCOMMAND) @$${RESPONSEFILE} > /dev/null && \
+	rm -f $${RESPONSEFILE} && \
+	touch $(1)
 
 endef
 
@@ -212,7 +215,7 @@ $(call gb_Helper_abbreviate_dirs_native,\
 	mkdir -p $(dir $(1)) && \
 	mkdir -p  $(gb_Helper_MISC) && \
 	RESPONSEFILE=`$(gb_MKTEMP)` && \
-	echo " -Gc -L -BUCR -O$(call gb_UnoApiTarget_get_header_target,$*) $(7) \
+	echo " -Gc -L -BUCR -O$(call gb_UnoApiTarget_get_header_target,$(2)) $(3) \
 		$(1) \
 		" > $${RESPONSEFILE} && \
 	$(gb_UnoApiTarget_CPPUMAKERCOMMAND) @$${RESPONSEFILE} && \
@@ -225,7 +228,6 @@ endef
 # - generate dependencies for included idls
 # - empty $? in headertarget?
 
-# TODO: reenable the check
 $(call gb_UnoApiTarget_get_target,%):
 	$(call gb_Output_announce,$*,$(true),RDB,3)
 	$(if $(gb_UnoApiTarget_IDLFILES_$*),$(call gb_UnoApiTarget__command,$@,$*,$<,UCR,$(addprefix $(call gb_UnoApiPartTarget_get_target,),$(patsubst %.idl,%.urd,$(gb_UnoApiTarget_IDLFILES_$*)))))
@@ -235,6 +237,6 @@ $(call gb_UnoApiTarget_get_target,%):
 	    $(gb_UnoApiTarget_REGCOMPARECOMMAND) -f -t -r1 $(call gb_Helper_convert_native,$(UNOAPI_REFERENCE)) -r2 $(call gb_Helper_convert_native,$@))
 	$(if $(gb_UnoApiTarget_IDLFILES_$*), \
 		$(call gb_Output_announce,$*,$(true),HPP,4) \
-		$(call gb_UnoApiHeaderTarget__command,$@,$*,$<,$?,$(INCLUDE),$(DEFS),$(UNOAPI_DEPS)))
+		$(call gb_UnoApiHeaderTarget__command,$@,$*,$(UNOAPI_DEPS)))
 
 # vim: set noet sw=4 ts=4:
commit 26450b3136979db86577591ef380040972d111fc
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 21:01:10 2012 +0100

    gbuild: UnoApiTarget: fix dependencies
    
    This should fix the bug, probably introduced with the per-directory
    performance enhancements, that after a change to an IDL file 2 builds
    are required to rebuild everything.

diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index e5415df..e557577 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -76,8 +76,10 @@ endef
 
 # for interfaces, exceptions, structs, enums, constant groups
 define gb_UnoApiTarget_add_idlfile
-$(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
-$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd) : $(call gb_UnoApiPartTarget_get_target,$(2)/idl.done)
+$(call gb_UnoApiTarget_get_target,$(1)) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done)
+$(call gb_UnoApiPartTarget_get_target,$(2)/idl.done) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hdl
 gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hpp
 gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
@@ -97,8 +99,10 @@ endef
 
 # for old-style services and modules
 define gb_UnoApiTarget_add_idlfile_noheader
-$(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
-$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd) : $(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done)
+$(call gb_UnoApiTarget_get_target,$(1)) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done)
+$(call gb_UnoApiPartTarget_get_target,$(2)/idl_noheader.done) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
 
 endef
@@ -113,8 +117,10 @@ endef
 
 # for new-style services
 define gb_UnoApiTarget_add_idlfile_nohdl
-$(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
-$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd) : $(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done)
+$(call gb_UnoApiTarget_get_target,$(1)) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done)
+$(call gb_UnoApiPartTarget_get_target,$(2)/idl_nohdl.done) : \
+	$(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd)
 gb_UnoApiTarget_HPPFILES_$(1) += $(2)/$(3).hpp
 gb_UnoApiTarget_IDLFILES_$(1) += $(2)/$(3).idl
 
@@ -170,11 +176,23 @@ $(call gb_UnoApiTarget_get_clean_target,%) :
 	-rm -rf $(call gb_UnoApiTarget_get_header_target,$*)\
 			$(call gb_UnoApiPartTarget_get_target,$*)
 
+# The .urd files are actually created by the gb_UnoApiPartTarget__command,
+# invoked for the per-directory .done files.
+# The reason why .urd files are tracked is so new files that are added are
+# picked up and cause a rebuild, even if older than the .done file (also, as a
+# convenience for users who delete them from the workdir by hand; this dummy
+# rule plus the dependency from the .done target to the .urd file plus the
+# sort/patsubst call in gb_UnoApiPartTarget__command cause command to be
+# invoked with the .idl file corresponding to the .urd in that case.
+$(call gb_UnoApiPartTarget_get_target,%.urd) :
+	@true
+
 define gb_UnoApiPartTarget__command
 	$$(call gb_Output_announce,$(2),$(true),IDL,2)
 	mkdir -p $(call gb_UnoApiPartTarget_get_target,$(2)) && \
 	RESPONSEFILE=$$(call var2file,$$(shell $(gb_MKTEMP)),500,\
-		$$(call gb_Helper_convert_native,$$(INCLUDE) $$(DEFS) -O $(call gb_UnoApiPartTarget_get_target,$(2)) -verbose -C $$?)) && \
+		$$(call gb_Helper_convert_native,$$(INCLUDE) $$(DEFS) -O $(call gb_UnoApiPartTarget_get_target,$(2)) -verbose -C \
+		$$(sort $$(patsubst $$(call gb_UnoApiPartTarget_get_target,%.urd),$(SRCDIR)/%.idl,$$?)))) && \
 	$(gb_UnoApiTarget_IDLCCOMMAND) @$$$${RESPONSEFILE} > /dev/null && \
 	rm -f $$$${RESPONSEFILE} && \
 	touch $$@
commit 88cceffc271e747be830675d62d24b6749a417f5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jan 14 20:59:35 2012 +0100

    connectivity: dbase: global variable cleanup

diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index 046b457..d0e9f5a 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -34,6 +34,7 @@
 #include "diagnose_ex.h"
 
 #include <algorithm>
+#include <boost/scoped_array.hpp>
 
 
 using namespace connectivity;
@@ -683,8 +684,6 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex)
     rStream >> aChild;
 }
 
-char aData[128];
-
 //------------------------------------------------------------------
 void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
 {
@@ -696,24 +695,32 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
 
     if (rIndex.getHeader().db_keytype) // double
     {
+        if (sizeof(double) != rIndex.getHeader().db_keylen)
+        {
+            OSL_TRACE("this key length cannot possibly be right?");
+        }
         if (aKey.getValue().isNull())
         {
-            memset(aData,0,rIndex.getHeader().db_keylen);
-            rStream.Write((sal_uInt8*)aData,rIndex.getHeader().db_keylen);
+            sal_uInt8 buf[sizeof(double)];
+            memset(&buf[0], 0, sizeof(double));
+            rStream.Write(&buf[0], sizeof(double));
         }
         else
             rStream << (double) aKey.getValue();
     }
     else
     {
-        memset(aData,0x20,rIndex.getHeader().db_keylen);
+        sal_uInt16 const nLen(rIndex.getHeader().db_keylen);
+        ::boost::scoped_array<sal_uInt8> pBuf(new sal_uInt8[nLen]);
+        memset(&pBuf[0], 0x20, nLen);
         if (!aKey.getValue().isNull())
         {
             ::rtl::OUString sValue = aKey.getValue();
             rtl::OString aText(rtl::OUStringToOString(sValue, rIndex.m_pTable->getConnection()->getTextEncoding()));
-            strncpy(aData, aText.getStr(), std::min<size_t>(rIndex.getHeader().db_keylen, aText.getLength()));
+            strncpy(reinterpret_cast<char *>(&pBuf[0]), aText.getStr(),
+                std::min<size_t>(nLen, aText.getLength()));
         }
-        rStream.Write((sal_uInt8*)aData,rIndex.getHeader().db_keylen);
+        rStream.Write(&pBuf[0], nLen);
     }
     rStream << aChild;
 }
commit ff2df7b7b61b557db6540ec7d3b38189677ac7f3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jan 13 23:54:07 2012 +0100

    SwXTextDocument: add some SolarMutexGuards

diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 77d399d..3ca2dee 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -569,6 +569,7 @@ void SwXTextDocument::dispose(void) throw( RuntimeException )
 
 void SwXTextDocument::close( sal_Bool bDeliverOwnership ) throw( util::CloseVetoException, RuntimeException )
 {
+    SolarMutexGuard aGuard;
     if(IsValid() && m_pHiddenViewFrame)
         lcl_DisposeView( m_pHiddenViewFrame, pDocShell);
     SfxBaseModel::close(bDeliverOwnership);
@@ -3023,6 +3024,7 @@ void SAL_CALL SwXTextDocument::render(
 Reference<XNameContainer> SAL_CALL SwXTextDocument::getXForms()
     throw( RuntimeException )
 {
+    SolarMutexGuard aGuard;
     if ( !pDocShell )
         throw DisposedException( ::rtl::OUString(), static_cast< XTextDocument* >( this ) );
     SwDoc* pDoc = pDocShell->GetDoc();
@@ -3032,6 +3034,7 @@ Reference<XNameContainer> SAL_CALL SwXTextDocument::getXForms()
 uno::Reference< text::XFlatParagraphIterator > SAL_CALL SwXTextDocument::getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic)
     throw ( uno::RuntimeException )
 {
+    SolarMutexGuard aGuard;
     return new SwXFlatParagraphIterator( *pDocShell->GetDoc(), nTextMarkupType, bAutomatic );
 }
 


More information about the Libreoffice-commits mailing list