[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 6 commits - dbaccess/source desktop/source extensions/source formula/source include/vcl reportdesign/source scripting/source sc/source sd/source sfx2/source svtools/source svx/source sw/source vcl/source

Michael Meeks michael.meeks at collabora.com
Tue May 26 06:00:22 PDT 2015


 dbaccess/source/ui/control/RelationControl.cxx        |    4 
 dbaccess/source/ui/control/TableGrantCtrl.cxx         |    4 
 dbaccess/source/ui/control/dbtreelistbox.cxx          |    2 
 dbaccess/source/ui/dlg/directsql.cxx                  |    2 
 dbaccess/source/ui/dlg/indexdialog.cxx                |    2 
 dbaccess/source/ui/querydesign/TableWindowListBox.cxx |    4 
 dbaccess/source/ui/tabledesign/TEditControl.cxx       |   10 +-
 desktop/source/deployment/gui/dp_gui_dialog2.cxx      |    8 -
 desktop/source/deployment/gui/dp_gui_dialog2.hxx      |    2 
 extensions/source/bibliography/bibview.cxx            |    2 
 extensions/source/propctrlr/formlinkdialog.cxx        |    2 
 formula/source/ui/dlg/funcutl.cxx                     |    4 
 include/vcl/window.hxx                                |    8 +
 reportdesign/source/ui/dlg/GroupsSorting.cxx          |    6 -
 reportdesign/source/ui/report/DesignView.cxx          |   10 +-
 reportdesign/source/ui/report/ViewsWindow.cxx         |    2 
 reportdesign/source/ui/report/propbrw.cxx             |    2 
 sc/source/ui/condformat/condformatdlg.cxx             |    2 
 sc/source/ui/inc/anyrefdg.hxx                         |   10 ++
 sc/source/ui/miscdlgs/anyrefdg.cxx                    |    7 +
 sc/source/ui/navipi/content.cxx                       |    2 
 sc/source/ui/pagedlg/tphf.cxx                         |    2 
 sc/source/ui/view/preview.cxx                         |    2 
 scripting/source/vbaevents/eventhelper.cxx            |    3 
 sd/source/ui/dlg/sdtreelb.cxx                         |    2 
 sfx2/source/control/recentdocsviewitem.cxx            |    2 
 sfx2/source/dialog/templdlg.cxx                       |    2 
 svtools/source/brwbox/editbrowsebox.cxx               |    6 -
 svtools/source/contnr/imivctl1.cxx                    |    4 
 svtools/source/contnr/svimpbox.cxx                    |    3 
 svtools/source/control/ruler.cxx                      |    6 -
 svtools/source/control/tabbar.cxx                     |    6 -
 svtools/source/dialogs/addresstemplate.cxx            |    2 
 svx/source/dialog/_bmpmask.cxx                        |    4 
 svx/source/fmcomp/fmgridcl.cxx                        |    2 
 svx/source/fmcomp/gridctrl.cxx                        |    6 -
 svx/source/form/delayedevent.cxx                      |   14 ---
 svx/source/form/filtnav.cxx                           |    2 
 svx/source/form/fmPropBrw.cxx                         |    2 
 svx/source/form/navigatortree.cxx                     |    2 
 svx/source/gallery2/galbrws1.cxx                      |    4 
 svx/source/tbxctrls/colrctrl.cxx                      |    2 
 svx/source/tbxctrls/grafctrl.cxx                      |    3 
 sw/source/ui/config/mailconfigpage.cxx                |    2 
 sw/source/ui/dbui/addresslistdialog.cxx               |    2 
 sw/source/ui/dbui/mmoutputtypepage.cxx                |    4 
 sw/source/uibase/dochdl/swdtflvr.cxx                  |    2 
 sw/source/uibase/docvw/SidebarWin.cxx                 |    4 
 sw/source/uibase/shells/textsh2.cxx                   |    2 
 sw/source/uibase/utlui/glbltree.cxx                   |    3 
 sw/source/uibase/utlui/navipi.cxx                     |    2 
 vcl/source/control/button.cxx                         |   14 +--
 vcl/source/control/combobox.cxx                       |    2 
 vcl/source/control/ctrl.cxx                           |    6 -
 vcl/source/control/edit.cxx                           |    2 
 vcl/source/control/fixed.cxx                          |    4 
 vcl/source/control/ilstbox.cxx                        |   12 +-
 vcl/source/control/lstbox.cxx                         |    2 
 vcl/source/control/scrbar.cxx                         |    6 -
 vcl/source/control/slider.cxx                         |    4 
 vcl/source/control/spinbtn.cxx                        |    8 -
 vcl/source/control/spinfld.cxx                        |    2 
 vcl/source/window/dialog.cxx                          |    6 -
 vcl/source/window/dlgctrl.cxx                         |    8 -
 vcl/source/window/event.cxx                           |    9 --
 vcl/source/window/globalization.cxx                   |    2 
 vcl/source/window/mouse.cxx                           |    4 
 vcl/source/window/window.cxx                          |   81 ++++++++++++++----
 vcl/source/window/window2.cxx                         |   22 ++--
 vcl/source/window/winproc.cxx                         |    4 
 70 files changed, 226 insertions(+), 169 deletions(-)

New commits:
commit 7dc00c7372a334bce7373cbdcd5a888cc4b37cd3
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon May 25 21:36:25 2015 +0100

    tdf#91577 - fix unique_ptr conversion bugs in reportdesign.
    
    Change-Id: Icc94ce266d567e7aad5afb5eacf0e85699ef4107

diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index aaa3414..0a6f567 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -139,26 +139,26 @@ void ODesignView::dispose()
     if ( m_pPropWin )
     {
         notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+        m_pPropWin.disposeAndClear();
     }
     if ( m_pAddField )
     {
         SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) );
         aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
         notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+        m_pAddField.disposeAndClear();
     }
     if ( m_pReportExplorer )
     {
         SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8));
         aDlgOpt.SetWindowState(OStringToOUString(m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
         notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+        m_pReportExplorer.disposeAndClear();
     }
 
-    m_aSplitWin.disposeAndClear();
+    m_pTaskPane.disposeAndClear();
     m_aScrollWindow.disposeAndClear();
-    m_pTaskPane.clear();
-    m_pReportExplorer.clear();
-    m_pPropWin.clear();
-    m_pAddField.clear();
+    m_aSplitWin.disposeAndClear();
     dbaui::ODataView::dispose();
 }
 
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 1d491d2..a998935 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -191,6 +191,8 @@ OViewsWindow::~OViewsWindow()
 void OViewsWindow::dispose()
 {
     m_aColorConfig.RemoveListener(this);
+    for (auto i = m_aSections.begin(); i != m_aSections.end(); ++i)
+        i->disposeAndClear();
     m_aSections.clear();
     m_pParent.clear();
     vcl::Window::dispose();
commit f0bbafba9d490c2628f1f60070aee877b64f5520
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon May 25 19:59:49 2015 +0100

    Audit all PostUserEvent calls and instrument for VclPtr.
    
    Hold a reference on the VclPtr while we're waiting for the UserEvent.
    
    Change-Id: I55c2671ca12eb14761c6a7dffd551af71547ecbd

diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 4988943..cfb56b6 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -193,9 +193,9 @@ namespace dbaui
     bool ORelationControl::PreNotify(NotifyEvent& rNEvt)
     {
         if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() )
-            PostUserEvent(LINK(this, ORelationControl, AsynchDeactivate));
+            PostUserEvent(LINK(this, ORelationControl, AsynchDeactivate), NULL, true);
         else if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
-            PostUserEvent(LINK(this, ORelationControl, AsynchActivate));
+            PostUserEvent(LINK(this, ORelationControl, AsynchActivate), NULL, true);
 
         return EditBrowseBox::PreNotify(rNEvt);
     }
diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index e370a91..a23925a 100644
--- a/dbaccess/source/ui/control/TableGrantCtrl.cxx
+++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx
@@ -156,13 +156,13 @@ bool OTableGrantControl::PreNotify(NotifyEvent& rNEvt)
         {
             if (m_nDeactivateEvent)
                 Application::RemoveUserEvent(m_nDeactivateEvent);
-            m_nDeactivateEvent = Application::PostUserEvent(LINK(this, OTableGrantControl, AsynchDeactivate));
+            m_nDeactivateEvent = Application::PostUserEvent(LINK(this, OTableGrantControl, AsynchDeactivate), NULL, true);
         }
     if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
     {
         if (m_nDeactivateEvent)
             Application::RemoveUserEvent(m_nDeactivateEvent);
-        m_nDeactivateEvent = Application::PostUserEvent(LINK(this, OTableGrantControl, AsynchActivate));
+        m_nDeactivateEvent = Application::PostUserEvent(LINK(this, OTableGrantControl, AsynchActivate), NULL, true);
     }
     return EditBrowseBox::PreNotify(rNEvt);
 }
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 13a5565..d8346df 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -133,7 +133,7 @@ void DBTreeListBox::RequestingChildren( SvTreeListEntry* pParent )
             // an error occurred. The method calling us will reset the entry flags, so it can't be expanded again.
             // But we want that the user may do a second try (i.e. because he misstypes a password in this try), so
             // we have to reset these flags controlling the expand ability
-            PostUserEvent(LINK(this, DBTreeListBox, OnResetEntry), pParent);
+            PostUserEvent(LINK(this, DBTreeListBox, OnResetEntry), pParent, true);
         }
     }
 }
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index eddc094..190d4a7 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -110,7 +110,7 @@ namespace dbaui
             aError->Execute();
         }
 
-        PostUserEvent(LINK(this, DirectSQLDialog, OnClose));
+        PostUserEvent(LINK(this, DirectSQLDialog, OnClose), NULL, true);
     }
 
     sal_Int32 DirectSQLDialog::getHistorySize() const
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 7abbb17..72456c0 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -631,7 +631,7 @@ namespace dbaui
 
             updateToolbox();
             m_bEditAgain = true;
-            PostUserEvent(LINK(this, DbaIndexDialog, OnEditIndexAgain), _pEntry);
+            PostUserEvent(LINK(this, DbaIndexDialog, OnEditIndexAgain), _pEntry, true);
             return 0L;
         }
 
diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
index 4db24a6..173d85f 100644
--- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
@@ -63,7 +63,7 @@ void OTableWindowListBox::dragFinished( )
     // second look for ui activities which should happen after d&d
     if (m_nUiEvent)
         Application::RemoveUserEvent(m_nUiEvent);
-    m_nUiEvent = Application::PostUserEvent(LINK(this, OTableWindowListBox, LookForUiHdl));
+    m_nUiEvent = Application::PostUserEvent(LINK(this, OTableWindowListBox, LookForUiHdl), NULL, true);
 }
 
 OTableWindowListBox::~OTableWindowListBox()
@@ -311,7 +311,7 @@ sal_Int8 OTableWindowListBox::ExecuteDrop( const ExecuteDropEvent& _rEvt )
 
         if (m_nDropEvent)
             Application::RemoveUserEvent(m_nDropEvent);
-        m_nDropEvent = Application::PostUserEvent(LINK(this, OTableWindowListBox, DropHdl));
+        m_nDropEvent = Application::PostUserEvent(LINK(this, OTableWindowListBox, DropHdl), NULL, true);
 
         return DND_ACTION_LINK;
     }
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index cc134b2..eb0c16f 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -665,7 +665,7 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
         else
             pActRow->SetFieldType( GetView()->getController().getTypeInfoFallBack() );
 
-        nInvalidateTypeEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, InvalidateFieldType) );
+        nInvalidateTypeEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, InvalidateFieldType), NULL, true );
         pActFieldDescr = pActRow->GetActFieldDescr();
         pDescrWin->DisplayData( pActFieldDescr );
         GetUndoManager().AddUndoAction( new OTableEditorTypeSelUndoAct(this, nRow, nColId+1, TOTypeInfoSP()) );
@@ -1222,7 +1222,7 @@ void OTableEditorCtrl::cut()
     {
         if (nCutEvent)
             Application::RemoveUserEvent(nCutEvent);
-        nCutEvent = Application::PostUserEvent(LINK(this, OTableEditorCtrl, DelayedCut));
+        nCutEvent = Application::PostUserEvent(LINK(this, OTableEditorCtrl, DelayedCut), NULL, true);
     }
 }
 
@@ -1245,7 +1245,7 @@ void OTableEditorCtrl::paste()
     {
         if( nPasteEvent )
             Application::RemoveUserEvent( nPasteEvent );
-        nPasteEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedPaste) );
+        nPasteEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedPaste), NULL, true );
     }
     else if(m_eChildFocus == NAME)
     {
@@ -1433,12 +1433,12 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
                         case SID_DELETE:
                             if( nDeleteEvent )
                                 Application::RemoveUserEvent( nDeleteEvent );
-                            nDeleteEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedDelete) );
+                            nDeleteEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedDelete), NULL, true );
                             break;
                         case SID_TABLEDESIGN_INSERTROWS:
                             if( nInsNewRowsEvent )
                                 Application::RemoveUserEvent( nInsNewRowsEvent );
-                            nInsNewRowsEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedInsNewRows) );
+                            nInsNewRowsEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedInsNewRows), NULL, true );
                             break;
                         case SID_TABLEDESIGN_TABED_PRIMARYKEY:
                             SetPrimaryKey( !IsPrimaryKey() );
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 0102292..92b802f 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -659,12 +659,12 @@ bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const
     return true;
 }
 
-void DialogHelper::PostUserEvent( const Link<>& rLink, void* pCaller )
+void DialogHelper::PostUserEvent( const Link<>& rLink, void* pCaller, bool bReferenceLink )
 {
     if ( m_nEventID )
         Application::RemoveUserEvent( m_nEventID );
 
-    m_nEventID = Application::PostUserEvent( rLink, pCaller );
+    m_nEventID = Application::PostUserEvent( rLink, pCaller, bReferenceLink );
 }
 
 //                             ExtMgrDialog
@@ -1020,7 +1020,7 @@ void ExtMgrDialog::showProgress( bool _bStart )
         OSL_TRACE( "showProgress stop!" );
     }
 
-    DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), reinterpret_cast<void*>(bStart) );
+    DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), reinterpret_cast<void*>(bStart), true );
 }
 
 
@@ -1342,7 +1342,7 @@ void UpdateRequiredDialog::showProgress( bool _bStart )
         OSL_TRACE( "showProgress stop!" );
     }
 
-    DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), reinterpret_cast<void*>(bStart) );
+    DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), reinterpret_cast<void*>(bStart), true );
 }
 
 
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index 46a0c9e..6e8037f 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -66,7 +66,7 @@ public:
 
     void            openWebBrowser( const OUString & sURL, const OUString & sTitle ) const;
     Dialog*         getWindow() const { return m_pVCLWindow; };
-    void            PostUserEvent( const Link<>& rLink, void* pCaller );
+    void            PostUserEvent( const Link<>& rLink, void* pCaller, bool bReferenceLink = false );
     void            clearEventID() { m_nEventID = 0; }
 
     virtual void    showProgress( bool bStart ) = 0;
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index 9e62d15..d1a8b95 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -153,7 +153,7 @@ namespace bib
             }
             if(bExecute)
             {
-                Application::PostUserEvent( LINK( this, BibView, CallMappingHdl ) );
+                Application::PostUserEvent( LINK( this, BibView, CallMappingHdl ), NULL, true );
             }
         }
     }
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index 3f02bd3..7101fe6 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -195,7 +195,7 @@ namespace pcr
         m_aRow3->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) );
         m_aRow4->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) );
 
-        PostUserEvent( LINK( this, FormLinkDialog, OnInitialize ) );
+        PostUserEvent( LINK( this, FormLinkDialog, OnInitialize ), NULL, true );
 
         updateOkButton();
     }
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 7f3e6f7..c620f38 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -422,7 +422,7 @@ bool EditBox::PreNotify( NotifyEvent& rNEvt )
         else
         {
             nResult=Control::PreNotify(rNEvt);
-            Application::PostUserEvent( LINK( this, EditBox, ChangedHdl ) );
+            Application::PostUserEvent( LINK( this, EditBox, ChangedHdl ), NULL, true );
         }
 
     }
@@ -433,7 +433,7 @@ bool EditBox::PreNotify( NotifyEvent& rNEvt )
         if(nSwitch==MouseNotifyEvent::MOUSEBUTTONDOWN || nSwitch==MouseNotifyEvent::MOUSEBUTTONUP)
         {
             bMouseFlag=true;
-            Application::PostUserEvent( LINK( this, EditBox, ChangedHdl ) );
+            Application::PostUserEvent( LINK( this, EditBox, ChangedHdl ), NULL, true );
         }
     }
     return nResult;
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index ff786a5..80cf6a6 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -760,7 +760,7 @@ void OFieldExpressionControl::Command(const CommandEvent& rEvt)
                     case SID_DELETE:
                         if( m_nDeleteEvent )
                             Application::RemoveUserEvent( m_nDeleteEvent );
-                        m_nDeleteEvent = Application::PostUserEvent( LINK(this, OFieldExpressionControl, DelayedDelete) );
+                        m_nDeleteEvent = Application::PostUserEvent( LINK(this, OFieldExpressionControl, DelayedDelete), NULL, true );
                         break;
                     default:
                         break;
@@ -867,7 +867,7 @@ void OFieldExpressionControl::paste()
     {
         if( m_nPasteEvent )
             Application::RemoveUserEvent( m_nPasteEvent );
-        m_nPasteEvent = Application::PostUserEvent( LINK(this, OFieldExpressionControl, DelayedPaste) );
+        m_nPasteEvent = Application::PostUserEvent( LINK(this, OFieldExpressionControl, DelayedPaste), NULL, true );
     }
 }
 
@@ -1178,7 +1178,7 @@ IMPL_LINK_NOARG_TYPED( OGroupsSortingDialog, OnFormatAction, ToolBox*, void )
         }
         if ( nCommand == m_nDeleteId )
         {
-            Application::PostUserEvent( LINK(m_pFieldExpression, OFieldExpressionControl, DelayedDelete) );
+            Application::PostUserEvent( LINK(m_pFieldExpression, OFieldExpressionControl, DelayedDelete), NULL, true );
         }
         else
         {
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index ba805f1..6706c74 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -487,7 +487,7 @@ void PropBrw::Update( OSectionView* pNewView )
         if ( m_bInitialStateChange )
         {
             // if we're just newly created, we want to have the focus
-            PostUserEvent( LINK( this, PropBrw, OnAsyncGetFocus ) );
+            PostUserEvent( LINK( this, PropBrw, OnAsyncGetFocus ), NULL, true );
             m_bInitialStateChange = false;
             // and additionally, we want to show the page which was active during
             // our previous incarnation
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 9f4d302..fe4ddbd 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -293,7 +293,7 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox)
     //If we call maEntries.replace here then the pBox will be deleted before it
     //has finished Select and will crash on accessing its deleted this. So Post
     //to do the real work after the Select has completed
-    Application::PostUserEvent(LINK(this, ScCondFormatList, AfterTypeListHdl), pBox);
+    Application::PostUserEvent(LINK(this, ScCondFormatList, AfterTypeListHdl), pBox, true);
     return 0;
 }
 
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index e6f607a..571dfd6 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -573,7 +573,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
             //  den StarView MouseMove-Handler, der Command() aufruft, umbringen.
             //  Deshalb Drag&Drop asynchron:
 
-            Application::PostUserEvent( LINK( this, ScContentTree, ExecDragHdl ) );
+            Application::PostUserEvent( LINK( this, ScContentTree, ExecDragHdl ), NULL, true );
 
             bDone = true;
             break;
diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx
index 70a5efc..cf1918e 100644
--- a/sc/source/ui/pagedlg/tphf.cxx
+++ b/sc/source/ui/pagedlg/tphf.cxx
@@ -165,7 +165,7 @@ IMPL_LINK_NOARG(ScHFPage, BtnHdl)
     // the GrabFocus from the Edit-Dialog under OS/2 doesn't work.(Bug #41805#).
     // With the new StarView, this workaround should be again considered!
 
-    Application::PostUserEvent( LINK( this, ScHFPage, HFEditHdl ) );
+    Application::PostUserEvent( LINK( this, ScHFPage, HFEditHdl ), NULL, true );
     return 0;
 }
 
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 0feb97d..42c98bb 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -898,7 +898,7 @@ void ScPreview::DoInvalidate()
     //  The Invalidate must come behind asynchronously
 
    if (bInGetState)
-        Application::PostUserEvent( LINK( this, ScPreview, InvalidateHdl ) );
+        Application::PostUserEvent( LINK( this, ScPreview, InvalidateHdl ), NULL, true );
     else
         StaticInvalidate();     // Immediately
 }
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 15224d50..616533c 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -706,7 +706,8 @@ EventListener::firing(const ScriptEvent& evt) throw(RuntimeException, std::excep
     // needs some logic to check if the event handler is oneway or not
     // if not oneway then firing_Impl otherwise... as below
     acquire();
-    Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ), new ScriptEvent( evt ) );
+    Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ),
+                                new ScriptEvent( evt ) );
 #else
     firing_Impl( evt );
 #endif
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 485f392..59b9d0f 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1171,7 +1171,7 @@ void SdPageObjsTLB::StartDrag( sal_Int8 nAction, const Point& rPosPixel)
         // another document type), but that would kill the StarView MouseMove
         // Handler which is calling Command().
         // For this reason, Drag&Drop is asynchronous.
-        Application::PostUserEvent( LINK( this, SdPageObjsTLB, ExecDragHdl ) );
+        Application::PostUserEvent( LINK( this, SdPageObjsTLB, ExecDragHdl ), NULL, true );
     }
 }
 
diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index 69c4a54..3d08e51 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -219,7 +219,7 @@ void RecentDocsViewItem::OpenDocument()
         pLoadRecentFile->aTargetURL = aTargetURL;
         pLoadRecentFile->aArgSeq = aArgsList;
 
-        Application::PostUserEvent(LINK(0, RecentDocsView, ExecuteHdl_Impl), pLoadRecentFile);
+        Application::PostUserEvent(LINK(0, RecentDocsView, ExecuteHdl_Impl), pLoadRecentFile, true);
     }
 }
 
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 43a186a..833a8af 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -269,7 +269,7 @@ sal_Int8 DropListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
             {
                 if ( aDesc.maClassName == pDocShell->GetFactory().GetClassId() )
                 {
-                    PostUserEvent( LINK( this, DropListBox_Impl, OnAsyncExecuteDrop ), 0 );
+                    PostUserEvent( LINK( this, DropListBox_Impl, OnAsyncExecuteDrop ), 0, true );
 
                     bFormatFound = true;
                     nRet =  rEvt.mnAction;
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 66cc84a..4957b3b 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -1072,7 +1072,7 @@ namespace svt
             // release the controller (asynchronously)
             if (nEndEvent)
                 Application::RemoveUserEvent(nEndEvent);
-            nEndEvent = Application::PostUserEvent(LINK(this,EditBrowseBox,EndEditHdl));
+            nEndEvent = Application::PostUserEvent(LINK(this,EditBrowseBox,EndEditHdl), NULL, true);
         }
     }
 
@@ -1106,7 +1106,7 @@ namespace svt
     {
         if (nCellModifiedEvent)
             Application::RemoveUserEvent(nCellModifiedEvent);
-        nCellModifiedEvent = Application::PostUserEvent(LINK(this,EditBrowseBox,CellModifiedHdl));
+        nCellModifiedEvent = Application::PostUserEvent(LINK(this,EditBrowseBox,CellModifiedHdl), NULL, true);
         return 0;
     }
 
@@ -1293,7 +1293,7 @@ namespace svt
             Application::RemoveUserEvent(nStartEvent);
 
         m_pFocusWhileRequest = Application::GetFocusWindow();
-        nStartEvent = Application::PostUserEvent(LINK(this,EditBrowseBox,StartEditHdl));
+        nStartEvent = Application::PostUserEvent(LINK(this,EditBrowseBox,StartEditHdl), NULL, true);
     }
 
 
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 5459f49..51dc4bb 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -1385,7 +1385,7 @@ void SvxIconChoiceCtrl_Impl::Resize()
     if ( ! nUserEventAdjustScrBars )
         nUserEventAdjustScrBars =
             Application::PostUserEvent( LINK( this, SvxIconChoiceCtrl_Impl, UserEventHdl),
-                EVENTID_ADJUST_SCROLLBARS);
+                                        EVENTID_ADJUST_SCROLLBARS);
 
     VisRectChanged();
 }
@@ -2088,7 +2088,7 @@ void SvxIconChoiceCtrl_Impl::SetCursor( SvxIconChoiceCtrlEntry* pEntry, bool bSy
             if( !nUserEventShowCursor )
                 nUserEventShowCursor =
                     Application::PostUserEvent( LINK( this, SvxIconChoiceCtrl_Impl, UserEventHdl),
-                        EVENTID_SHOW_CURSOR );
+                                                EVENTID_SHOW_CURSOR );
         }
     }
 }
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 9431266..56f9cba 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -902,7 +902,8 @@ void SvImpLBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect
             aVerSBar->SetThumbPos( 0 );
             StopUserEvent();
             ShowCursor(true);
-            nCurUserEvent = Application::PostUserEvent(LINK(this, SvImpLBox, MyUserEvent), reinterpret_cast<void*>(1));
+            nCurUserEvent = Application::PostUserEvent(LINK(this, SvImpLBox, MyUserEvent),
+                                                       reinterpret_cast<void*>(1));
             return;
         }
     }
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index b6ff5aa..eec2e39 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -1483,7 +1483,7 @@ void Ruler::ImplUpdate( bool bMustCalc )
     {
         mnUpdateFlags |= RULER_UPDATE_DRAW;
         if (!mnUpdateEvtId)
-            mnUpdateEvtId = Application::PostUserEvent(LINK( this, Ruler, ImplUpdateHdl), NULL );
+            mnUpdateEvtId = Application::PostUserEvent(LINK( this, Ruler, ImplUpdateHdl), NULL, true);
     }
 }
 
@@ -2196,7 +2196,7 @@ void Ruler::Resize()
         Invalidate();
         mnUpdateFlags |= RULER_UPDATE_LINES;
         if ( !mnUpdateEvtId )
-            mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL );
+            mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL, true );
     }
     mbFormat = true;
 
@@ -2340,7 +2340,7 @@ void Ruler::Activate()
     // update positionlies - draw is delayed
     mnUpdateFlags |= RULER_UPDATE_LINES;
     if ( !mnUpdateEvtId )
-        mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL );
+        mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL, true );
 }
 
 void Ruler::Deactivate()
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 7df57d1..09c5442 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -427,7 +427,7 @@ bool TabBarEdit::PreNotify( NotifyEvent& rNEvt )
             {
                 if ( !mbPostEvt )
                 {
-                    if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), reinterpret_cast<void*>(sal_False) ) )
+                    if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), reinterpret_cast<void*>(sal_False), true ) )
                         mbPostEvt = true;
                 }
                 return true;
@@ -436,7 +436,7 @@ bool TabBarEdit::PreNotify( NotifyEvent& rNEvt )
             {
                 if ( !mbPostEvt )
                 {
-                    if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), reinterpret_cast<void*>(sal_True) ) )
+                    if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), reinterpret_cast<void*>(sal_True), true ) )
                         mbPostEvt = true;
                 }
                 return true;
@@ -451,7 +451,7 @@ void TabBarEdit::LoseFocus()
 {
     if ( !mbPostEvt )
     {
-        if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), reinterpret_cast<void*>(sal_False) ) )
+        if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), reinterpret_cast<void*>(sal_False), true ) )
             mbPostEvt = true;
     }
 
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index fdcb525..88f079a 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -655,7 +655,7 @@ void AssignmentPersistentData::ImplCommit()
         for (sal_Int32 i = 0; i<nAdjustedTokenCount; ++i)
             m_pImpl->aLogicalFieldNames.push_back(sLogicalFieldNames.getToken(i, ';'));
 
-        PostUserEvent(LINK(this, AddressBookSourceDialog, OnDelayedInitialize));
+        PostUserEvent(LINK(this, AddressBookSourceDialog, OnDelayedInitialize), NULL, true);
             // so the dialog will at least show up before we do the loading of the
             // configuration data and the (maybe time consuming) analysis of the data source/table to select
 
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 71290f0..413bae0 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -363,7 +363,7 @@ sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt )
         m_pImpl->xDroppedStatement = xStatement;
         m_pImpl->xDroppedResultSet = xResultSet;
 
-        PostUserEvent(LINK(this, FmGridHeader, OnAsyncExecuteDrop));
+        PostUserEvent(LINK(this, FmGridHeader, OnAsyncExecuteDrop), NULL, true);
     }
     catch (Exception&)
     {
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index df26ebb..76920e1 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2679,7 +2679,7 @@ void DbGridControl::PostExecuteRowContextMenu(sal_uInt16 /*nRow*/, const PopupMe
             // delete asynchronously
             if (m_nDeleteEvent)
                 Application::RemoveUserEvent(m_nDeleteEvent);
-            m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete));
+            m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete), NULL, true);
             break;
         case SID_FM_RECORD_UNDO:
             Undo();
@@ -3258,7 +3258,7 @@ bool DbGridControl::PreNotify(NotifyEvent& rEvt)
                     // delete asynchronously
                     if (m_nDeleteEvent)
                         Application::RemoveUserEvent(m_nDeleteEvent);
-                    m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete));
+                    m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete), NULL, true);
                     return true;
                 }
             }
@@ -3434,7 +3434,7 @@ void DbGridControl::implAdjustInSolarThread(bool _bRows)
     ::osl::MutexGuard aGuard(m_aAdjustSafety);
     if (::osl::Thread::getCurrentIdentifier() != Application::GetMainThreadIdentifier())
     {
-        m_nAsynAdjustEvent = PostUserEvent(LINK(this, DbGridControl, OnAsyncAdjust), reinterpret_cast< void* >( _bRows ));
+        m_nAsynAdjustEvent = PostUserEvent(LINK(this, DbGridControl, OnAsyncAdjust), reinterpret_cast< void* >( _bRows ), true);
         m_bPendingAdjustRows = _bRows;
         if (_bRows)
             SAL_INFO("svx.fmcomp", "posting an AdjustRows");
diff --git a/svx/source/form/delayedevent.cxx b/svx/source/form/delayedevent.cxx
index f06fc1d..1063d0f 100644
--- a/svx/source/form/delayedevent.cxx
+++ b/svx/source/form/delayedevent.cxx
@@ -17,20 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include "delayedevent.hxx"
-
 #include <vcl/svapp.hxx>
 
-
 namespace svxform
 {
-
-
-
-    //= DelayedEvent
-
-
     void DelayedEvent::Call( void* _pArg )
     {
         CancelPendingCall();
@@ -39,7 +30,6 @@ namespace svxform
         m_nEventId = Application::PostUserEvent( LINK( this, DelayedEvent, OnCall ), _pArg );
     }
 
-
     void DelayedEvent::CancelPendingCall()
     {
         if ( m_nEventId )
@@ -47,15 +37,11 @@ namespace svxform
         m_nEventId = 0;
     }
 
-
     IMPL_LINK( DelayedEvent, OnCall, void*, _pArg )
     {
         m_nEventId = 0;
         return m_aHandler.Call( _pArg );
     }
-
-
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 98e1f45..0ac78df 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1212,7 +1212,7 @@ bool FmFilterNavigator::EditedEntry( SvTreeListEntry* pEntry, const OUString& rN
     if (aText.isEmpty())
     {
         // deleting the entry asynchron
-        PostUserEvent(LINK(this, FmFilterNavigator, OnRemove), pEntry);
+        PostUserEvent(LINK(this, FmFilterNavigator, OnRemove), pEntry, true);
     }
     else
     {
diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx
index 3d86527..427a16a 100644
--- a/svx/source/form/fmPropBrw.cxx
+++ b/svx/source/form/fmPropBrw.cxx
@@ -648,7 +648,7 @@ void FmPropBrw::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPool
             if ( m_bInitialStateChange )
             {
                 // if we're just newly created, we want to have the focus
-                PostUserEvent( LINK( this, FmPropBrw, OnAsyncGetFocus ) );
+                PostUserEvent( LINK( this, FmPropBrw, OnAsyncGetFocus ), NULL, true );
 
                 // and additionally, we want to show the page which was active during
                 // our previous incarnation
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 938c166..95152e4 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -1473,7 +1473,7 @@ namespace svxform
         if( !bRes )
         {
             m_pEditEntry = pEntry;
-            nEditEvent = Application::PostUserEvent( LINK(this, NavigatorTree, OnEdit) );
+            nEditEvent = Application::PostUserEvent( LINK(this, NavigatorTree, OnEdit), NULL, true );
         } else
             SetCursor(pEntry, true);
 
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 854ce84..24c20e4 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -324,7 +324,7 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog
     }
 
     // destroy mpThemeProps asynchronously
-    Application::PostUserEvent( LINK( this, GalleryBrowser1, DestroyThemePropertiesDlgHdl ), pDialog );
+    Application::PostUserEvent( LINK( this, GalleryBrowser1, DestroyThemePropertiesDlgHdl ), pDialog, true );
 }
 
 IMPL_LINK( GalleryBrowser1, EndNewThemePropertiesDlgHdl, VclAbstractDialog2*, pDialog )
@@ -509,7 +509,7 @@ void GalleryBrowser1::Notify( SfxBroadcaster&, const SfxHint& rHint )
 
 void GalleryBrowser1::ShowContextMenu()
 {
-    Application::PostUserEvent( LINK( this, GalleryBrowser1, ShowContextMenuHdl ), this );
+    Application::PostUserEvent( LINK( this, GalleryBrowser1, ShowContextMenuHdl ), this, true );
 }
 
 bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow )
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index 0796f53..54f7260 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -150,7 +150,7 @@ void SvxColorValueSet_docking::Command(const CommandEvent& rCEvt)
 
 void SvxColorValueSet_docking::StartDrag( sal_Int8 , const Point&  )
 {
-    Application::PostUserEvent(LINK(this, SvxColorValueSet_docking, ExecDragHdl));
+    Application::PostUserEvent(LINK(this, SvxColorValueSet_docking, ExecDragHdl), NULL, true);
 }
 
 void SvxColorValueSet_docking::DoDrag()
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
index da58030..3c16c99 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -254,7 +254,7 @@ SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pPare
 
     m_pStopPB->SetClickHdl(LINK(this, SwTestAccountSettingsDialog, StopHdl));
 
-    Application::PostUserEvent( LINK( this, SwTestAccountSettingsDialog, TestHdl ), this );
+    Application::PostUserEvent( LINK( this, SwTestAccountSettingsDialog, TestHdl ), this, true );
 }
 
 SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog()
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 550b626..0ca561c 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -475,7 +475,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, ListBoxSelectHdl_Impl)
 {
     SvTreeListEntry* pSelect = m_pListLB->FirstSelected();
     Application::PostUserEvent( LINK( this, SwAddressListDialog,
-                                                StaticListBoxSelectHdl_Impl ), pSelect );
+                                      StaticListBoxSelectHdl_Impl ), pSelect, true );
     return 0;
 }
 
diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx
index 84b62ba2..7819538d 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -540,7 +540,7 @@ void  SwSendMailDialog::IterateMails()
 void SwSendMailDialog::ShowDialog()
 {
     Application::PostUserEvent( LINK( this, SwSendMailDialog,
-                                                StartSendMails ), this );
+                                      StartSendMails ), this, true );
     ModelessDialog::Show();
 }
 
@@ -564,7 +564,7 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessag
         m_pImpl->xMailDispatcher.is() && m_pImpl->xMailDispatcher->isStarted())
     {
         Application::PostUserEvent( LINK( this, SwSendMailDialog,
-                                                    StopSendMails ), this );
+                                          StopSendMails ), this, true );
     }
     Image aInsertImg = m_aImageList.GetImage( bResult ? FN_FORMULA_APPLY : FN_FORMULA_CANCEL );
 
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 884e383..360a16b 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2586,7 +2586,7 @@ bool SwTransferable::_PasteFileName( TransferableDataHelper& rData,
                     pSect->SetProtectFlag( true );
 
                     Application::PostUserEvent( LINK( &rSh, SwWrtShell,
-                                                InsertRegionDialog ), pSect );
+                                                      InsertRegionDialog ), pSect );
                     nRet = true;
                     }
                 else if( SW_PASTESDR_SETATTR == nAction ||
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index c8fa945..516eb9a 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -1027,7 +1027,7 @@ void SwSidebarWin::DeactivatePostIt()
 
     if ( !IsProtected() && Engine()->GetEditEngine().GetText().isEmpty() )
     {
-        mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+        mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0, true );
     }
 }
 
@@ -1071,7 +1071,7 @@ void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot)
         case FN_DELETE_COMMENT:
 
                 //Delete(); // do not kill the parent of our open popup menu
-                mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+                mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0, true );
             break;
         case FN_FORMAT_ALL_NOTES:
         case FN_DELETE_ALL_NOTES:
diff --git a/sw/source/uibase/shells/textsh2.cxx b/sw/source/uibase/shells/textsh2.cxx
index 0622645..671c9e3 100644
--- a/sw/source/uibase/shells/textsh2.cxx
+++ b/sw/source/uibase/shells/textsh2.cxx
@@ -155,7 +155,7 @@ void SwTextShell::ExecDB(SfxRequest &rReq)
                     pNew->xConnection           = xConnection;
 
                     Application::PostUserEvent( LINK( this, SwBaseShell,
-                                            InsertDBTextHdl ), pNew );
+                                                      InsertDBTextHdl ), pNew );
                     // the pNew will be removed in InsertDBTextHdl !!
                 }
             }
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index e068da2..e622d58 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1179,8 +1179,7 @@ void SwGlobalTree::OpenDoc(const SwGlblDocContent* pCont)
         {
             bFound = true;
             SwGlobalTree::SetShowShell(pCurr);
-            Application::PostUserEvent( LINK(
-                        this, SwGlobalTree, ShowFrameHdl ) );
+            Application::PostUserEvent( LINK( this, SwGlobalTree, ShowFrameHdl ), NULL, true );
             pCurr = 0;
         }
         else
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 25e7277..1141bef 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -217,7 +217,7 @@ IMPL_LINK_TYPED( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox, void )
         {
             // #i75416# move the execution of the search to an asynchronously called static link
             bool* pbNext = new bool( FN_DOWN == nCurrItemId );
-            Application::PostUserEvent( LINK(pView, SwView, MoveNavigationHdl), pbNext );
+            Application::PostUserEvent( LINK(pView, SwView, MoveNavigationHdl), pbNext, true );
         }
         break;
         case FN_SHOW_ROOT:
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index d76d0c9..c87ed80 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -604,7 +604,7 @@ bool Dialog::Notify( NotifyEvent& rNEvt )
                 // like e.g. SfxModelessDialog which destroy themselves inside Close()
                 // post this Close asynchronous so we can leave our key handler before
                 // we get destroyed
-                PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this , true);
+                PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this, true);
                 return true;
             }
         }
commit 9aebad8b58a7ee36284e465a40101d2a045d00dd
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon May 25 20:20:22 2015 +0100

    tdf#91525 - dispose SfxControllerItem member.
    
    Change-Id: I71b32c1db2f4695deb90412e83b9e7883e9bf1d7

diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 90d97f3..b7b7217 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -335,8 +335,6 @@ SvxBmpMaskSelectItem::SvxBmpMaskSelectItem( sal_uInt16 nId_, SvxBmpMask& rMask,
 {
 }
 
-
-
 void SvxBmpMaskSelectItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
                                          const SfxPoolItem* pItem )
 {
@@ -487,6 +485,7 @@ void SvxBmpMask::dispose()
     m_pQSet4.disposeAndClear();
     m_pCtlPipette.disposeAndClear();
     delete pData;
+    pData = NULL;
     m_pTbxPipette.clear();
     m_pBtnExec.clear();
     m_pCbx1.clear();
@@ -503,6 +502,7 @@ void SvxBmpMask::dispose()
     m_pLbColor4.clear();
     m_pCbxTrans.clear();
     m_pLbColorTrans.clear();
+    aSelItem.dispose();
     SfxDockingWindow::dispose();
 }
 
commit 010eb0628f8f934c3c3d41f4b6338fa8935c95b9
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat May 23 22:28:08 2015 +0100

    tdf#91431 - fix post-dispose focus issue in color window.
    
    Change-Id: I7990cbddc8c664da5ec6521cf8e036ca67d5ce0e

diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 3e5e255..cb5add9 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -307,7 +307,8 @@ void ImplGrafControl::dispose()
 
 void ImplGrafControl::GetFocus()
 {
-    maField->GrabFocus();
+    if (maField)
+        maField->GrabFocus();
 }
 
 class ImplGrafModeControl : public ListBox
commit 08ab1bc21e327b4178877aafe0424d8888a09e9b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat May 23 19:44:15 2015 +0100

    VclPtr - add compat methods for old-style focus / notification.
    
    The previous code would only invoke Window:: methods by the time we
    hit the destructor; do the same to avoid fixing more scattered
    crashers for now.
    
    Reviewed-on: https://gerrit.libreoffice.org/15880
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    
    Conflicts:
    	vcl/source/control/slider.cxx
    
    Change-Id: Ibdcd1290309bb7fc31a44d534c52d357da022591

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 9e760e3..4b167a3 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -763,6 +763,14 @@ public:
     virtual bool                        Notify( NotifyEvent& rNEvt );
     virtual vcl::Window*                GetPreferredKeyInputWindow();
 
+    // These methods call the relevant virtual method when not in/post dispose
+    void                                CompatGetFocus();
+    void                                CompatLoseFocus();
+    void                                CompatStateChanged( StateChangedType nStateChange );
+    void                                CompatDataChanged( const DataChangedEvent& rDCEvt );
+    bool                                CompatPreNotify( NotifyEvent& rNEvt );
+    bool                                CompatNotify( NotifyEvent& rNEvt );
+
     void                                AddEventListener( const Link<>& rEventListener );
     void                                RemoveEventListener( const Link<>& rEventListener );
     void                                AddChildEventListener( const Link<>& rEventListener );
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index fa49f99..b6256bd 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1545,7 +1545,7 @@ void PushButton::SetSymbol( SymbolType eSymbol )
     if ( meSymbol != eSymbol )
     {
         meSymbol = eSymbol;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
@@ -1559,7 +1559,7 @@ void PushButton::SetDropDown( PushButtonDropdownStyle nStyle )
     if ( mnDDStyle != nStyle )
     {
         mnDDStyle = nStyle;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
@@ -1581,7 +1581,7 @@ void PushButton::SetState( TriState eState )
             ImplGetButtonState() |= DrawButtonFlags::DontKnow;
         }
 
-        StateChanged( StateChangedType::State );
+        CompatStateChanged( StateChangedType::State );
         Toggle();
     }
 }
@@ -1591,7 +1591,7 @@ void PushButton::SetPressed( bool bPressed )
     if ( mbPressed != bPressed )
     {
         mbPressed = bPressed;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
@@ -2638,7 +2638,7 @@ bool RadioButton::SetModeRadioImage( const Image& rImage )
     if ( rImage != maImage )
     {
         maImage = rImage;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
         queue_resize();
     }
     return true;
@@ -2656,7 +2656,7 @@ void RadioButton::SetState( bool bCheck )
     if ( mbChecked != bCheck )
     {
         mbChecked = bCheck;
-        StateChanged( StateChangedType::State );
+        CompatStateChanged( StateChangedType::State );
         Toggle();
     }
 }
@@ -2713,7 +2713,7 @@ void RadioButton::Check( bool bCheck )
         mbChecked = bCheck;
         ImplDelData aDelData;
         ImplAddDel( &aDelData );
-        StateChanged( StateChangedType::State );
+        CompatStateChanged( StateChangedType::State );
         if ( aDelData.IsDead() )
             return;
         if ( bCheck && mbRadioCheck )
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index b30317f..b60774d 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -664,7 +664,7 @@ void ComboBox::StateChanged( StateChangedType nType )
             mpBtn->EnableRTL( IsRTLEnabled() );
             ImplInitDropDownButton( mpBtn );
         }
-        mpSubEdit->StateChanged( StateChangedType::Mirroring );
+        mpSubEdit->CompatStateChanged( StateChangedType::Mirroring );
         mpImplLB->EnableRTL( IsRTLEnabled() );
         Resize();
     }
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 38aa416..a0a70e5 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -81,7 +81,7 @@ void Control::EnableRTL( bool bEnable )
     // convenience: for controls also switch layout mode
     SetLayoutMode( bEnable ? TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT :
                                 TEXT_LAYOUT_TEXTORIGIN_LEFT );
-    StateChanged( StateChangedType::Mirroring );
+    CompatStateChanged( StateChangedType::Mirroring );
     OutputDevice::EnableRTL(bEnable);
 }
 
@@ -256,7 +256,7 @@ bool Control::Notify( NotifyEvent& rNEvt )
             if ( !mbHasControlFocus )
             {
                 mbHasControlFocus = true;
-                StateChanged( StateChangedType::ControlFocus );
+                CompatStateChanged( StateChangedType::ControlFocus );
                 if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, maGetFocusHdl, this ) )
                     // been destroyed within the handler
                     return true;
@@ -270,7 +270,7 @@ bool Control::Notify( NotifyEvent& rNEvt )
                 if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) )
                 {
                     mbHasControlFocus = false;
-                    StateChanged( StateChangedType::ControlFocus );
+                    CompatStateChanged( StateChangedType::ControlFocus );
                     if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, maLoseFocusHdl, this ) )
                         // been destroyed within the handler
                         return true;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 1cc602b..3c211b7 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2454,7 +2454,7 @@ void Edit::SetReadOnly( bool bReadOnly )
         if ( mpSubEdit )
             mpSubEdit->SetReadOnly( bReadOnly );
 
-        StateChanged( StateChangedType::ReadOnly );
+        CompatStateChanged( StateChangedType::ReadOnly );
     }
 }
 
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index dd7c27e..533d9c9 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -843,7 +843,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt )
 void FixedBitmap::SetBitmap( const Bitmap& rBitmap )
 {
     maBitmap = rBitmap;
-    StateChanged( StateChangedType::Data );
+    CompatStateChanged( StateChangedType::Data );
     queue_resize();
 }
 
@@ -1020,7 +1020,7 @@ void FixedImage::SetImage( const Image& rImage )
     if ( rImage != maImage )
     {
         maImage = rImage;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
         queue_resize();
     }
 }
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index beca62b..7438cce 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2205,7 +2205,7 @@ void ImplListBox::Clear()
     }
     mpVScrollBar->SetThumbPos( 0 );
     mpHScrollBar->SetThumbPos( 0 );
-    StateChanged( StateChangedType::Data );
+    CompatStateChanged( StateChangedType::Data );
 }
 
 sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
@@ -2217,7 +2217,7 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
         delete pNewEntry;
         return nNewPos;
     }
-    StateChanged( StateChangedType::Data );
+    CompatStateChanged( StateChangedType::Data );
     return nNewPos;
 }
 
@@ -2230,14 +2230,14 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const
         delete pNewEntry;
         return nNewPos;
     }
-    StateChanged( StateChangedType::Data );
+    CompatStateChanged( StateChangedType::Data );
     return nNewPos;
 }
 
 void ImplListBox::RemoveEntry( sal_Int32 nPos )
 {
     maLBWindow->RemoveEntry( nPos );
-    StateChanged( StateChangedType::Data );
+    CompatStateChanged( StateChangedType::Data );
 }
 
 void ImplListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
@@ -2277,7 +2277,7 @@ void ImplListBox::Resize()
 
 IMPL_LINK_NOARG(ImplListBox, MRUChanged)
 {
-    StateChanged( StateChangedType::Data );
+    CompatStateChanged( StateChangedType::Data );
     return 1;
 }
 
@@ -2593,7 +2593,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
     {
         maLBWindow->GetEntryList()->SetMRUCount( nMRUCount );
         SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 3a4d633..3f8f5e3 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1404,7 +1404,7 @@ void ListBox::SetReadOnly( bool bReadOnly )
     if ( mpImplLB->IsReadOnly() != bReadOnly )
     {
         mpImplLB->SetReadOnly( bReadOnly );
-        StateChanged( StateChangedType::ReadOnly );
+        CompatStateChanged( StateChangedType::ReadOnly );
     }
 }
 
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 8e9f4b7..da769c8 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1387,7 +1387,7 @@ void ScrollBar::SetRange( const Range& rRange )
         if ( mnThumbPos < mnMinRange )
             mnThumbPos = mnMinRange;
 
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
@@ -1401,7 +1401,7 @@ void ScrollBar::SetThumbPos( long nNewThumbPos )
     if ( mnThumbPos != nNewThumbPos )
     {
         mnThumbPos = nNewThumbPos;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
@@ -1416,7 +1416,7 @@ void ScrollBar::SetVisibleSize( long nNewSize )
             mnThumbPos = mnMaxRange-mnVisibleSize;
         if ( mnThumbPos < mnMinRange )
             mnThumbPos = mnMinRange;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
index fb566e8..04dcab6 100644
--- a/vcl/source/control/slider.cxx
+++ b/vcl/source/control/slider.cxx
@@ -948,7 +948,7 @@ void Slider::SetRange( const Range& rRange )
         if ( mnThumbPos < mnMinRange )
             mnThumbPos = mnMinRange;
 
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
@@ -962,7 +962,7 @@ void Slider::SetThumbPos( long nNewThumbPos )
     if ( mnThumbPos != nNewThumbPos )
     {
         mnThumbPos = nNewThumbPos;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
index 2f196d6..6d1d5f3 100644
--- a/vcl/source/control/spinbtn.cxx
+++ b/vcl/source/control/spinbtn.cxx
@@ -76,7 +76,7 @@ void SpinButton::Up()
     if (ImplIsUpperEnabled())
     {
         mnValue += mnValueStep;
-        StateChanged(StateChangedType::Data);
+        CompatStateChanged(StateChangedType::Data);
 
         ImplMoveFocus(true);
     }
@@ -89,7 +89,7 @@ void SpinButton::Down()
     if (ImplIsLowerEnabled())
     {
         mnValue -= mnValueStep;
-        StateChanged(StateChangedType::Data);
+        CompatStateChanged(StateChangedType::Data);
 
         ImplMoveFocus(false);
     }
@@ -372,7 +372,7 @@ void SpinButton::SetRange( const Range& rRange )
         if ( mnValue < mnMinRange )
             mnValue = mnMinRange;
 
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
@@ -387,7 +387,7 @@ void SpinButton::SetValue( long nValue )
     if ( mnValue != nValue )
     {
         mnValue = nValue;
-        StateChanged( StateChangedType::Data );
+        CompatStateChanged( StateChangedType::Data );
     }
 }
 
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 28cf70f..aa185e1 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -824,7 +824,7 @@ void SpinField::StateChanged(StateChangedType nType)
     else if( nType == StateChangedType::Mirroring )
     {
         if (mpEdit)
-            mpEdit->StateChanged(StateChangedType::Mirroring);
+            mpEdit->CompatStateChanged(StateChangedType::Mirroring);
         Resize();
     }
 }
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 93273a7..d76d0c9 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -805,7 +805,7 @@ bool Dialog::ImplStartExecuteModal()
     if ( GetParent() )
     {
         NotifyEvent aNEvt( MouseNotifyEvent::EXECUTEDIALOG, this );
-        GetParent()->Notify( aNEvt );
+        GetParent()->CompatNotify( aNEvt );
     }
     mbInExecute = true;
     SetModalInputMode( true );
@@ -933,7 +933,7 @@ void Dialog::EndDialog( long nResult )
         if ( GetParent() )
         {
             NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
-            GetParent()->Notify( aNEvt );
+            GetParent()->CompatNotify( aNEvt );
         }
 
         mpDialogImpl->mnResult = nResult;
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index eb899fd..e927590 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -689,11 +689,11 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
             {
                 NotifyEvent aNEvt1( MouseNotifyEvent::LOSEFOCUS, pSWindow );
                 if ( !ImplCallPreNotify( aNEvt1 ) )
-                    pSWindow->LoseFocus();
+                    pSWindow->CompatLoseFocus();
                 pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
                 NotifyEvent aNEvt2( MouseNotifyEvent::GETFOCUS, pSWindow );
                 if ( !ImplCallPreNotify( aNEvt2 ) )
-                    pSWindow->GetFocus();
+                    pSWindow->CompatGetFocus();
                 pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
                 return true;
             }
@@ -821,11 +821,11 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
                         {
                             NotifyEvent aNEvt1( MouseNotifyEvent::LOSEFOCUS, pSWindow );
                             if ( !ImplCallPreNotify( aNEvt1 ) )
-                                pSWindow->LoseFocus();
+                                pSWindow->CompatLoseFocus();
                             pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
                             NotifyEvent aNEvt2( MouseNotifyEvent::GETFOCUS, pSWindow );
                             if ( !ImplCallPreNotify( aNEvt2 ) )
-                                pSWindow->GetFocus();
+                                pSWindow->CompatGetFocus();
                             pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
                             return true;
                         }
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 3e729fd..61c11ab 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -38,8 +38,7 @@ void Window::DataChanged( const DataChangedEvent& )
 
 void Window::NotifyAllChildren( DataChangedEvent& rDCEvt )
 {
-
-    DataChanged( rDCEvt );
+    CompatDataChanged( rDCEvt );
 
     vcl::Window* pChild = mpWindowImpl->mpFirstChild;
     while ( pChild )
@@ -53,7 +52,7 @@ bool Window::PreNotify( NotifyEvent& rNEvt )
 {
     bool bDone = false;
     if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
-        bDone = mpWindowImpl->mpParent->PreNotify( rNEvt );
+        bDone = mpWindowImpl->mpParent->CompatPreNotify( rNEvt );
 
     if ( !bDone )
     {
@@ -194,7 +193,7 @@ bool Window::Notify( NotifyEvent& rNEvt )
     if ( !nRet )
     {
         if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
-            nRet = mpWindowImpl->mpParent->Notify( rNEvt );
+            nRet = mpWindowImpl->mpParent->CompatNotify( rNEvt );
     }
 
     return nRet;
@@ -427,7 +426,7 @@ void Window::ImplCallInitShow()
 {
     mpWindowImpl->mbReallyShown   = true;
     mpWindowImpl->mbInInitShow    = true;
-    StateChanged( StateChangedType::InitShow );
+    CompatStateChanged( StateChangedType::InitShow );
     mpWindowImpl->mbInInitShow    = false;
 
     vcl::Window* pWindow = mpWindowImpl->mpFirstOverlap;
diff --git a/vcl/source/window/globalization.cxx b/vcl/source/window/globalization.cxx
index 980a586..1c56638 100644
--- a/vcl/source/window/globalization.cxx
+++ b/vcl/source/window/globalization.cxx
@@ -24,7 +24,7 @@ namespace vcl {
 
 void Window::EnableRTL ( bool bEnable )
 {
-    StateChanged( StateChangedType::Mirroring );
+    CompatStateChanged( StateChangedType::Mirroring );
     OutputDevice::EnableRTL(bEnable);
 }
 
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 6dd6014..cab23bc 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -356,7 +356,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
                 pOldFocusWindow->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Focus );
             NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pOldFocusWindow );
             if ( !ImplCallPreNotify( aNEvt ) )
-                pOldFocusWindow->LoseFocus();
+                pOldFocusWindow->CompatLoseFocus();
             pOldFocusWindow->ImplCallDeactivateListeners( this );
         }
 
@@ -384,7 +384,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
                     mpWindowImpl->mnGetFocusFlags |= GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL;
                 NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this );
                 if ( !ImplCallPreNotify( aNEvt ) && !aDogTag.IsDead() )
-                    GetFocus();
+                    CompatGetFocus();
                 if( !aDogTag.IsDead() )
                     ImplCallActivateListeners( (pOldFocusWindow && ! aOldFocusDel.IsDead()) ? pOldFocusWindow : NULL );
                 if( !aDogTag.IsDead() )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 17a4590..8be6e90 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -398,7 +398,7 @@ void Window::dispose()
     // announce the window is to be destroyed
     {
         NotifyEvent aNEvt( MouseNotifyEvent::DESTROY, this );
-        Notify( aNEvt );
+        CompatNotify( aNEvt );
     }
 
     // EndExtTextInputMode
@@ -1910,14 +1910,14 @@ void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const
 void Window::KeyInput( const KeyEvent& rKEvt )
 {
     NotifyEvent aNEvt( MouseNotifyEvent::KEYINPUT, this, &rKEvt );
-    if ( !Notify( aNEvt ) )
+    if ( !CompatNotify( aNEvt ) )
         mpWindowImpl->mbKeyInput = true;
 }
 
 void Window::KeyUp( const KeyEvent& rKEvt )
 {
     NotifyEvent aNEvt( MouseNotifyEvent::KEYUP, this, &rKEvt );
-    if ( !Notify( aNEvt ) )
+    if ( !CompatNotify( aNEvt ) )
         mpWindowImpl->mbKeyUp = true;
 }
 
@@ -1944,13 +1944,13 @@ void Window::GetFocus()
     }
 
     NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this );
-    Notify( aNEvt );
+    CompatNotify( aNEvt );
 }
 
 void Window::LoseFocus()
 {
     NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, this );
-    Notify( aNEvt );
+    CompatNotify( aNEvt );
 }
 
 void Window::RequestHelp( const HelpEvent& rHEvt )
@@ -2008,7 +2008,7 @@ void Window::Command( const CommandEvent& rCEvt )
     CallEventListeners( VCLEVENT_WINDOW_COMMAND, (void*)&rCEvt );
 
     NotifyEvent aNEvt( MouseNotifyEvent::COMMAND, this, &rCEvt );
-    if ( !Notify( aNEvt ) )
+    if ( !CompatNotify( aNEvt ) )
         mpWindowImpl->mbCommand = true;
 }
 
@@ -2064,12 +2064,11 @@ bool Window::IsLocked( bool bChildren ) const
 
 void Window::SetStyle( WinBits nStyle )
 {
-
-    if ( mpWindowImpl->mnStyle != nStyle )
+    if ( mpWindowImpl && mpWindowImpl->mnStyle != nStyle )
     {
         mpWindowImpl->mnPrevStyle = mpWindowImpl->mnStyle;
         mpWindowImpl->mnStyle = nStyle;
-        StateChanged( StateChangedType::Style );
+        CompatStateChanged( StateChangedType::Style );
     }
 }
 
@@ -2093,7 +2092,7 @@ void Window::SetExtendedStyle( WinBits nExtendedStyle )
         }
         mpWindowImpl->mnPrevExtendedStyle = mpWindowImpl->mnExtendedStyle;
         mpWindowImpl->mnExtendedStyle = nExtendedStyle;
-        StateChanged( StateChangedType::ExtendedStyle );
+        CompatStateChanged( StateChangedType::ExtendedStyle );
     }
 }
 
@@ -2303,7 +2302,7 @@ void Window::Show(bool bVisible, sal_uInt16 nFlags)
             mpWindowImpl->mpFrame->Show( false, false );
         }
 
-        StateChanged( StateChangedType::Visible );
+        CompatStateChanged( StateChangedType::Visible );
 
         if ( mpWindowImpl->mbReallyVisible )
         {
@@ -2391,7 +2390,7 @@ void Window::Show(bool bVisible, sal_uInt16 nFlags)
             ImplCallResize();
         }
 
-        StateChanged( StateChangedType::Visible );
+        CompatStateChanged( StateChangedType::Visible );
 
         vcl::Window* pTestParent;
         if ( ImplIsOverlapWindow() )
@@ -2578,7 +2577,7 @@ void Window::Enable( bool bEnable, bool bChild )
         mpWindowImpl->mbDisabled = !bEnable;
         if ( mpWindowImpl->mpSysObj )
             mpWindowImpl->mpSysObj->Enable( bEnable && !mpWindowImpl->mbInputDisabled );
-        StateChanged( StateChangedType::Enable );
+        CompatStateChanged( StateChangedType::Enable );
 
         CallEventListeners( bEnable ? VCLEVENT_WINDOW_ENABLED : VCLEVENT_WINDOW_DISABLED );
     }
@@ -2673,7 +2672,7 @@ void Window::EnableInput( bool bEnable, bool bChild )
     if ( bNotify )
     {
         NotifyEvent aNEvt( bEnable ? MouseNotifyEvent::INPUTENABLE : MouseNotifyEvent::INPUTDISABLE, this );
-        Notify( aNEvt );
+        CompatNotify( aNEvt );
     }
 }
 
@@ -3130,9 +3129,8 @@ void Window::Sync()
 
 void Window::SetUpdateMode( bool bUpdate )
 {
-
     mpWindowImpl->mbNoUpdate = !bUpdate;
-    StateChanged( StateChangedType::UpdateMode );
+    CompatStateChanged( StateChangedType::UpdateMode );
 }
 
 void Window::GrabFocus()
@@ -3203,7 +3201,7 @@ void Window::SetText( const OUString& rStr )
             pWindow->CallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle );
     }
 
-    StateChanged( StateChangedType::Text );
+    CompatStateChanged( StateChangedType::Text );
 }
 
 OUString Window::GetText() const
@@ -3723,7 +3721,7 @@ void Window::EnableNativeWidget( bool bEnable )
         // send datachanged event to allow for internal changes required for NWF
         // like clipmode, transparency, etc.
         DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, mxSettings.get(), AllSettingsFlags::STYLE );
-        DataChanged( aDCEvt );
+        CompatDataChanged( aDCEvt );
 
         // sometimes the borderwindow is queried, so keep it in sync
         if( mpWindowImpl->mpBorderWindow )
@@ -3946,6 +3944,53 @@ void Window::SetDoubleBuffering(bool bDoubleBuffering)
     mpWindowImpl->mbDoubleBuffering = bDoubleBuffering;
 }
 
+/*
+ * The rational here is that we moved destructors to
+ * dispose and this altered a lot of code paths, that
+ * are better left unchanged for now.
+ */
+#define COMPAT_BODY(method,args) \
+    if (!mpWindowImpl || mpWindowImpl->mbInDispose) \
+        Window::method args; \
+    else \
+        method args;
+
+void Window::CompatGetFocus()
+{
+    COMPAT_BODY(GetFocus,())
+}
+
+void Window::CompatLoseFocus()
+{
+    COMPAT_BODY(LoseFocus,())
+}
+
+void Window::CompatStateChanged( StateChangedType nStateChange )
+{
+    COMPAT_BODY(StateChanged,(nStateChange))
+}
+
+void Window::CompatDataChanged( const DataChangedEvent& rDCEvt )
+{
+    COMPAT_BODY(DataChanged,(rDCEvt))
+}
+
+bool Window::CompatPreNotify( NotifyEvent& rNEvt )
+{
+    if (!mpWindowImpl || mpWindowImpl->mbInDispose)
+        return Window::PreNotify( rNEvt );
+    else
+        return PreNotify( rNEvt );
+}
+
+bool Window::CompatNotify( NotifyEvent& rNEvt )
+{
+    if (!mpWindowImpl || mpWindowImpl->mbInDispose)
+        return Window::Notify( rNEvt );
+    else
+        return Notify( rNEvt );
+}
+
 } /* namespace vcl */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index dd436d9..1e70a62 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -509,10 +509,10 @@ bool Window::EndSaveFocus( sal_uIntPtr nSaveId, bool bRestore )
 
 void Window::SetZoom( const Fraction& rZoom )
 {
-    if ( mpWindowImpl->maZoom != rZoom )
+    if ( mpWindowImpl && mpWindowImpl->maZoom != rZoom )
     {
         mpWindowImpl->maZoom = rZoom;
-        StateChanged( StateChangedType::Zoom );
+        CompatStateChanged( StateChangedType::Zoom );
     }
 }
 
@@ -577,11 +577,11 @@ long Window::CalcZoom( long nCalc ) const
 
 void Window::SetControlFont()
 {
-    if (mpWindowImpl->mpControlFont)
+    if (mpWindowImpl && mpWindowImpl->mpControlFont)
     {
         delete mpWindowImpl->mpControlFont;
         mpWindowImpl->mpControlFont = NULL;
-        StateChanged(StateChangedType::ControlFont);
+        CompatStateChanged(StateChangedType::ControlFont);
     }
 }
 
@@ -602,7 +602,7 @@ void Window::SetControlFont(const vcl::Font& rFont)
     else
         mpWindowImpl->mpControlFont = new vcl::Font(rFont);
 
-    StateChanged(StateChangedType::ControlFont);
+    CompatStateChanged(StateChangedType::ControlFont);
 }
 
 vcl::Font Window::GetControlFont() const
@@ -630,7 +630,7 @@ void Window::SetControlForeground()
     {
         mpWindowImpl->maControlForeground = Color(COL_TRANSPARENT);
         mpWindowImpl->mbControlForeground = false;
-        StateChanged(StateChangedType::ControlForeground);
+        CompatStateChanged(StateChangedType::ControlForeground);
     }
 }
 
@@ -642,7 +642,7 @@ void Window::SetControlForeground(const Color& rColor)
         {
             mpWindowImpl->maControlForeground = Color(COL_TRANSPARENT);
             mpWindowImpl->mbControlForeground = false;
-            StateChanged(StateChangedType::ControlForeground);
+            CompatStateChanged(StateChangedType::ControlForeground);
         }
     }
     else
@@ -651,7 +651,7 @@ void Window::SetControlForeground(const Color& rColor)
         {
             mpWindowImpl->maControlForeground = rColor;
             mpWindowImpl->mbControlForeground = true;
-            StateChanged(StateChangedType::ControlForeground);
+            CompatStateChanged(StateChangedType::ControlForeground);
         }
     }
 }
@@ -670,7 +670,7 @@ void Window::SetControlBackground()
     {
         mpWindowImpl->maControlBackground = Color(COL_TRANSPARENT);
         mpWindowImpl->mbControlBackground = false;
-        StateChanged(StateChangedType::ControlBackground);
+        CompatStateChanged(StateChangedType::ControlBackground);
     }
 }
 
@@ -682,7 +682,7 @@ void Window::SetControlBackground(const Color& rColor)
         {
             mpWindowImpl->maControlBackground = Color(COL_TRANSPARENT);
             mpWindowImpl->mbControlBackground = false;
-            StateChanged(StateChangedType::ControlBackground);
+            CompatStateChanged(StateChangedType::ControlBackground);
         }
     }
     else
@@ -691,7 +691,7 @@ void Window::SetControlBackground(const Color& rColor)
         {
             mpWindowImpl->maControlBackground = rColor;
             mpWindowImpl->mbControlBackground = true;
-            StateChanged(StateChangedType::ControlBackground);
+            CompatStateChanged(StateChangedType::ControlBackground);
         }
     }
 }
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index ccbbb62..be93192 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -57,7 +57,7 @@
 bool ImplCallPreNotify( NotifyEvent& rEvt )
 {
     return Application::CallEventHooks( rEvt )
-        || rEvt.GetWindow()->PreNotify( rEvt );
+        || rEvt.GetWindow()->CompatPreNotify( rEvt );
 }
 
 static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePos,
@@ -1866,7 +1866,7 @@ IMPL_LINK_NOARG(vcl::Window, ImplAsyncFocusHdl)
                 {
                     NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pFocusWin );
                     if ( !ImplCallPreNotify( aNEvt ) )
-                        pFocusWin->LoseFocus();
+                        pFocusWin->CompatLoseFocus();
                     pFocusWin->ImplCallDeactivateListeners( NULL );
                 }
                 // XXX
commit 41b234cfa52c9e41b1780d4686a140bcc1c7b27a
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat May 23 19:59:55 2015 +0100

    tdf#91499 - cleanup AnyRefDialog VclPtr's with an explicit dispose method.
    
    Change-Id: Ib3571fc6d2aa9343bcfd2d6a5bdbd6b1d193c0f1
    Reviewed-on: https://gerrit.libreoffice.org/15883
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 5bcc688..5f717ff 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -127,6 +127,7 @@ private:
     DECL_LINK_TYPED( UpdateFocusHdl, Idle*, void );
 
 protected:
+    void                disposeRefHandler();
     bool                DoClose( sal_uInt16 nId );
 
     static void         SetDispatcherLock( bool bLock );
@@ -280,9 +281,16 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef >
         SC_MOD()->RegisterRefWindow( static_cast<sal_uInt16>( static_cast<TDerived*>(this)->SLOTID ), this );
     }
 
-    ~ScRefHdlrImpl()
+    virtual void dispose() SAL_OVERRIDE
     {
         SC_MOD()->UnregisterRefWindow( static_cast<sal_uInt16>( static_cast<TDerived*>(this)->SLOTID ), this );
+        ScRefHdlrImplBase<TBase, bBindRef >::disposeRefHandler();
+        TBase::dispose();
+    }
+
+    ~ScRefHdlrImpl()
+    {
+        dispose();
     }
 };
 
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 99d4f58..34ecb42 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -823,6 +823,13 @@ bool ScRefHandler::EnterRefMode()
 
 ScRefHandler::~ScRefHandler()
 {
+    disposeRefHandler();
+}
+
+void ScRefHandler::disposeRefHandler()
+{
+    m_rWindow.clear();
+    pActiveWin.clear();
     LeaveRefMode();
 }
 


More information about the Libreoffice-commits mailing list