[PATCH] fix awt::UnoControlModelDialog crash

Noel Grandin (via Code Review) gerrit at gerrit.libreoffice.org
Thu May 23 07:41:59 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4013

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/13/4013/1

fix awt::UnoControlModelDialog crash

...in commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654,
    "Convert awt::UnoControlDialogModel to new style"
I added an attribute "ResourceResolver" because some of the client
code was setting it using the property interface.

It turns out that this was a bad idea because the "ResourceResolver"
property is doing some very interesting stuff, so revert that part
of the change.

Change-Id: I62b890e60164e005867ced49c3e407a49ed09441
---
M include/toolkit/controls/dialogcontrol.hxx
M offapi/com/sun/star/awt/XUnoControlDialogModel.idl
M offapi/com/sun/star/resource/XStringResourceManager.idl
M offapi/com/sun/star/resource/XStringResourceResolver.idl
M scripting/source/dlgprov/dlgprov.cxx
M toolkit/source/controls/dialogcontrol.cxx
6 files changed, 7 insertions(+), 17 deletions(-)



diff --git a/include/toolkit/controls/dialogcontrol.hxx b/include/toolkit/controls/dialogcontrol.hxx
index f92652a..a749c24 100644
--- a/include/toolkit/controls/dialogcontrol.hxx
+++ b/include/toolkit/controls/dialogcontrol.hxx
@@ -166,9 +166,6 @@
        { return getPropertyString("ImageURL"); }
     virtual void SAL_CALL setImageURL(const rtl::OUString& p1) throw(::com::sun::star::uno::RuntimeException)
        { setPropertyString("ImageURL", p1); }
-    virtual com::sun::star::uno::Reference<com::sun::star::resource::XStringResourceManager> SAL_CALL getResourceResolver() throw(::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL setResourceResolver(const com::sun::star::uno::Reference<com::sun::star::resource::XStringResourceManager>& p1) throw(::com::sun::star::uno::RuntimeException)
-        { setPropertyValue( "ResourceResolver", css::uno::Any(p1) ); }
     virtual com::sun::star::awt::FontDescriptor SAL_CALL getFontDescriptor() throw(::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL setFontDescriptor(const com::sun::star::awt::FontDescriptor& p1) throw(::com::sun::star::uno::RuntimeException)
         { setPropertyValue( "FontDescriptor", css::uno::Any(p1) ); }
diff --git a/offapi/com/sun/star/awt/XUnoControlDialogModel.idl b/offapi/com/sun/star/awt/XUnoControlDialogModel.idl
index 81cd2b1..9032a37 100644
--- a/offapi/com/sun/star/awt/XUnoControlDialogModel.idl
+++ b/offapi/com/sun/star/awt/XUnoControlDialogModel.idl
@@ -28,7 +28,6 @@
 #include <com/sun/star/lang/XMultiServiceFactory.idl>
 #include <com/sun/star/util/Color.idl>
 #include <com/sun/star/graphic/XGraphic.idl>
-#include <com/sun/star/resource/XStringResourceManager.idl>
 
 
 module com {  module sun {  module star {  module awt {
@@ -66,8 +65,6 @@
     [attribute] long Height;
 
     [attribute] string DialogSourceURL;
-
-    [attribute] com::sun::star::resource::XStringResourceManager ResourceResolver;
 
     /** specifies the text that is displayed in the caption bar of the dialog.
      */
diff --git a/offapi/com/sun/star/resource/XStringResourceManager.idl b/offapi/com/sun/star/resource/XStringResourceManager.idl
index 423bedf..ad9a8f3 100644
--- a/offapi/com/sun/star/resource/XStringResourceManager.idl
+++ b/offapi/com/sun/star/resource/XStringResourceManager.idl
@@ -44,7 +44,7 @@
     localized dialogs.
 
 */
-published interface XStringResourceManager: com::sun::star::resource::XStringResourceResolver
+interface XStringResourceManager: com::sun::star::resource::XStringResourceResolver
 {
     /**
         Returns the resource's read only state
diff --git a/offapi/com/sun/star/resource/XStringResourceResolver.idl b/offapi/com/sun/star/resource/XStringResourceResolver.idl
index 49bd841..d236f0d 100644
--- a/offapi/com/sun/star/resource/XStringResourceResolver.idl
+++ b/offapi/com/sun/star/resource/XStringResourceResolver.idl
@@ -42,7 +42,7 @@
     But also changing the locale at runtime can be supported in this way.
 
 */
-published interface XStringResourceResolver: com::sun::star::util::XModifyBroadcaster
+interface XStringResourceResolver: com::sun::star::util::XModifyBroadcaster
 {
     /**
         Resolves the passed ResoureID for the current locale. This
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 8722a47..8c645a3 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -88,6 +88,8 @@
 {
 //.........................................................................
 
+static OUString aResourceResolverPropName("ResourceResolver");
+
     Reference< resource::XStringResourceManager > lcl_getStringResourceManager(const Reference< XComponentContext >& i_xContext,const OUString& i_sURL)
     {
         INetURLObject aInetObj( i_sURL );
@@ -147,7 +149,9 @@
         // Set resource property
         if( xStringResourceManager.is() )
         {
-            xDialogModel->setResourceResolver( xStringResourceManager );
+            Any aStringResourceManagerAny;
+            aStringResourceManagerAny <<= xStringResourceManager;
+            xDialogModel->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny );
         }
 
         return xDialogModel;
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index bd3ce4c..6042203 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -307,14 +307,6 @@
    return b;
 }
 
-Reference<css::resource::XStringResourceManager> UnoControlDialogModel::getResourceResolver() throw(css::uno::RuntimeException)
-{
-   uno::Any any = getPropertyValue("ResourceResolver");
-   Reference<css::resource::XStringResourceManager> b;
-   any >>= b;
-   return b;
-}
-
 css::awt::FontDescriptor UnoControlDialogModel::getFontDescriptor() throw(css::uno::RuntimeException)
 {
    uno::Any any = getPropertyValue("FontDescriptor");

-- 
To view, visit https://gerrit.libreoffice.org/4013
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62b890e60164e005867ced49c3e407a49ed09441
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin at gmail.com>



More information about the LibreOffice mailing list