Kaydet (Commit) 3ecb9b4b authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen Kaydeden (comit) Björn Michaelsen

tdf#99352: assert on stray VclPtrs past DeInit

- ignore on Windows for now, as it is acting up

Change-Id: I98dbb887ed556b58188870c3eb3de1327bc58109
Reviewed-on: https://gerrit.libreoffice.org/35816Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
üst 0144600b
......@@ -12,6 +12,10 @@
#include <sal/config.h>
#ifdef DBG_UTIL
#include <vcl/dllapi.h>
#endif
namespace vclmain {
// Function called from vclmain's implementation of main, needs to be
......@@ -19,7 +23,9 @@ namespace vclmain {
// instance of Application (where the Application constructor takes care to link
// that instance to ImplSVData.mpApp):
void createApplication();
#ifdef DBG_UTIL
VCL_DLLPUBLIC bool isAlive();
#endif
}
#endif
......
......@@ -29,6 +29,12 @@
#include <utility>
#include <type_traits>
#ifdef DBG_UTIL
#ifndef WNT
#include <vcl/vclmain.hxx>
#endif
#endif
/// @cond INTERNAL
namespace vcl { namespace detail {
......@@ -136,6 +142,15 @@ public:
{
}
#ifdef DBG_UTIL
#ifndef WNT
virtual ~VclPtr()
{
assert(m_rInnerRef.get() == nullptr || vclmain::isAlive());
}
#endif
#endif
/**
* A construction helper for VclPtr. Since VclPtr types are created
* with a reference-count of one - to help fit into the existing
......
......@@ -49,6 +49,7 @@
#include <tools/urlobj.hxx>
#include <algorithm>
#include <map>
#include <array>
namespace svt
......@@ -423,8 +424,8 @@ void AssignmentPersistentData::ImplCommit()
struct AddressBookSourceDialogData
{
VclPtr<FixedText> pFieldLabels[FIELD_PAIRS_VISIBLE * 2];
VclPtr<ListBox> pFields[FIELD_PAIRS_VISIBLE * 2];
std::array<VclPtr<FixedText>, FIELD_PAIRS_VISIBLE*2> pFieldLabels;
std::array<VclPtr<ListBox>, FIELD_PAIRS_VISIBLE*2> pFields;
/// when working transient, we need the data source
Reference< XDataSource >
......@@ -449,27 +450,27 @@ void AssignmentPersistentData::ImplCommit()
AddressBookSourceDialogData( )
:nFieldScrollPos(0)
:pFieldLabels{{nullptr}}
,pFields{{nullptr}}
,nFieldScrollPos(0)
,nLastVisibleListIndex(0)
,bOddFieldNumber(false)
,bWorkingPersistent( true )
,pConfigData( new AssignmentPersistentData )
{
memset(pFieldLabels, 0, sizeof(pFieldLabels));
memset(pFields, 0, sizeof(pFields));
}
AddressBookSourceDialogData( const Reference< XDataSource >& _rxTransientDS, const OUString& _rDataSourceName,
const OUString& _rTableName, const Sequence< AliasProgrammaticPair >& _rFields )
:m_xTransientDataSource( _rxTransientDS )
:pFieldLabels{{nullptr}}
,pFields{{nullptr}}
,m_xTransientDataSource( _rxTransientDS )
,nFieldScrollPos(0)
,nLastVisibleListIndex(0)
,bOddFieldNumber(false)
,bWorkingPersistent( false )
,pConfigData( new AssigmentTransientData( _rDataSourceName, _rTableName, _rFields ) )
{
memset(pFieldLabels, 0, sizeof(pFieldLabels));
memset(pFields, 0, sizeof(pFields));
}
// Copy assignment is forbidden and not implemented.
......@@ -977,14 +978,14 @@ void AssignmentPersistentData::ImplCommit()
// loop through our field control rows and do some adjustments
// for the new texts
VclPtr<FixedText>* pLeftLabelControl = m_pImpl->pFieldLabels;
VclPtr<FixedText>* pRightLabelControl = pLeftLabelControl + 1;
auto pLeftLabelControl = m_pImpl->pFieldLabels.begin();
auto pRightLabelControl = pLeftLabelControl+1;
auto pLeftColumnLabel = m_pImpl->aFieldLabels.cbegin() + 2 * _nPos;
auto pRightColumnLabel = pLeftColumnLabel + 1;
// for the focus movement and the selection scroll
VclPtr<ListBox>* pLeftListControl = m_pImpl->pFields;
VclPtr<ListBox>* pRightListControl = pLeftListControl + 1;
auto pLeftListControl = m_pImpl->pFields.begin();
auto pRightListControl = pLeftListControl + 1;
// for the focus movement
sal_Int32 nOldFocusRow = -1;
......
......@@ -102,6 +102,7 @@ typedef std::pair<VclPtr<vcl::Window>, ImplPostEventData *> ImplPostEventPair;
struct ImplSVAppData
{
~ImplSVAppData();
enum ImeStatusWindowMode
{
ImeStatusWindowMode_UNKNOWN,
......@@ -182,6 +183,7 @@ struct ImplSVGDIData
struct ImplSVWinData
{
~ImplSVWinData();
VclPtr<vcl::Window> mpFirstFrame; // First FrameWindow
VclPtr<WorkWindow> mpAppWin; // Application-Window
VclPtr<vcl::Window> mpFocusWin; // window, that has the focus
......@@ -227,6 +229,7 @@ struct ImplSVCtrlData
struct ImplSVHelpData
{
~ImplSVHelpData();
bool mbContextHelp = false; // is ContextHelp enabled
bool mbExtHelp = false; // is ExtendedHelp enabled
bool mbExtHelpMode = false; // is in ExtendedHelp Mode
......@@ -308,6 +311,7 @@ struct BlendFrameCache
struct ImplSVData
{
~ImplSVData();
SalData* mpSalData = nullptr;
SalInstance* mpDefInst = nullptr; // Default SalInstance
Application* mpApp = nullptr; // pApp
......
......@@ -28,14 +28,19 @@
#include <tools/gen.hxx>
#include <uno/current_context.hxx>
#include <vcl/configsettings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/layout.hxx>
#include <vcl/button.hxx>
#include <vcl/configsettings.hxx>
#include <vcl/dockwin.hxx>
#include <vcl/layout.hxx>
#include <vcl/menu.hxx>
#include <vcl/print.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
#include <vcl/wrkwin.hxx>
#include <scrwnd.hxx>
#include <helpwin.hxx>
#include <vcl/dialog.hxx>
#include <vcl/virdev.hxx>
#include "salinst.hxx"
#include "salframe.hxx"
......@@ -79,14 +84,6 @@ SalSystem* ImplGetSalSystem()
return pSVData->mpSalSystem;
}
ImplSVGDIData::~ImplSVGDIData()
{
// FIXME: deliberately leak any remaining OutputDevice
// until we have their pGraphics reference counted, doing
// any disposes so late in shutdown is rather unsafe.
memset( this, 0, sizeof( ImplSVGDIData ) );
}
void ImplDeInitSVData()
{
ImplSVData* pSVData = ImplGetSVData();
......@@ -301,4 +298,11 @@ void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadc
AllSettings::LocaleSettingsChanged( nHint );
}
ImplSVData::~ImplSVData() {}
ImplSVAppData::~ImplSVAppData() {}
ImplSVGDIData::~ImplSVGDIData() {}
ImplSVWinData::~ImplSVWinData() {}
ImplSVHelpData::~ImplSVHelpData() {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -46,6 +46,11 @@
#include <vcl/lazydelete.hxx>
#include <vcl/embeddedfontshelper.hxx>
#include <vcl/debugevent.hxx>
#include <vcl/dialog.hxx>
#include <vcl/menu.hxx>
#include <vcl/virdev.hxx>
#include <vcl/print.hxx>
#include <scrwnd.hxx>
#ifdef _WIN32
#include <svsys.h>
......@@ -267,6 +272,17 @@ static bool isInitVCL()
pSVData->mpDefInst != nullptr;
}
#ifdef DBG_UTIL
namespace vclmain
{
bool isAlive()
{
return ImplGetSVData()->mpDefInst;
}
}
#endif
bool InitVCL()
{
if( pExceptionHandler != nullptr )
......@@ -364,6 +380,7 @@ void DeInitVCL()
::comphelper::JoinAsyncEventNotifiers();
}
ImplSVData* pSVData = ImplGetSVData();
// lp#1560328: clear cache before disposing rest of VCL
if(pSVData->mpBlendFrameCache)
pSVData->mpBlendFrameCache->m_aLastResult.Clear();
......@@ -545,6 +562,31 @@ void DeInitVCL()
delete pSVData->mpSalTimer;
pSVData->mpSalTimer = nullptr;
pSVData->mpDefaultWin = nullptr;
pSVData->mpIntroWindow = nullptr;
pSVData->maAppData.mpActivePopupMenu = nullptr;
pSVData->maAppData.mpWheelWindow = nullptr;
pSVData->maGDIData.mpFirstWinGraphics = nullptr;
pSVData->maGDIData.mpLastWinGraphics = nullptr;
pSVData->maGDIData.mpFirstVirGraphics = nullptr;
pSVData->maGDIData.mpLastVirGraphics = nullptr;
pSVData->maGDIData.mpFirstPrnGraphics = nullptr;
pSVData->maGDIData.mpLastPrnGraphics = nullptr;
pSVData->maGDIData.mpFirstVirDev = nullptr;
pSVData->maGDIData.mpLastVirDev = nullptr;
pSVData->maGDIData.mpFirstPrinter = nullptr;
pSVData->maGDIData.mpLastPrinter = nullptr;
pSVData->maWinData.mpFirstFrame = nullptr;
pSVData->maWinData.mpAppWin = nullptr;
pSVData->maWinData.mpActiveApplicationFrame = nullptr;
pSVData->maWinData.mpCaptureWin = nullptr;
pSVData->maWinData.mpLastDeacWin = nullptr;
pSVData->maWinData.mpFirstFloat = nullptr;
pSVData->maWinData.mpLastExecuteDlg = nullptr;
pSVData->maWinData.mpExtTextInputWin = nullptr;
pSVData->maWinData.mpTrackWin = nullptr;
pSVData->maWinData.mpAutoScrollWin = nullptr;
pSVData->maWinData.mpLastWheelWindow = nullptr;
// Deinit Sal
if (pSVData->mpDefInst)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment