compilerplugins/clang/badstatics.cxx | 63 ++++++++- compilerplugins/clang/check.hxx | 16 ++ vcl/inc/svdata.hxx | 229 +++++++++++++++++------------------ vcl/source/app/svapp.cxx | 22 +-- vcl/source/app/svdata.cxx | 10 - 5 files changed, 198 insertions(+), 142 deletions(-)
New commits: commit 995318e2996abac01dbbbc73f61e93cbb7acd453 Author: Stephan Bergmann <sberg...@redhat.com> Date: Sat Oct 8 23:55:08 2016 +0200 loplugin:badstatics: reliably look into std container types Change-Id: Ifca7325533e3f7d5ce5c59cc6b14d4232d4fc792 Reviewed-on: https://gerrit.libreoffice.org/29614 Reviewed-by: Stephan Bergmann <sberg...@redhat.com> Tested-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index db5b0dd..7ac7820 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -7,6 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <cassert> + #include "check.hxx" #include "plugin.hxx" @@ -30,20 +32,27 @@ public: QualType const& rpType, std::vector<FieldDecl const*> & chain, std::vector<QualType> const& rParents) { - QualType const pCanonical(rpType.getUnqualifiedType().getCanonicalType()); - if (pCanonical->isPointerType() || pCanonical->isReferenceType()) { - QualType const pPointee(pCanonical->getPointeeType().getUnqualifiedType().getCanonicalType()); + QualType pt; + if (rpType->isAnyPointerType()) { + pt = rpType->getPointeeType(); + } else if (auto at = rpType->getAsArrayTypeUnsafe()) { + pt = at->getElementType(); + } else if (auto rt = rpType->getAs<ReferenceType>()) { + pt = rt->getPointeeType(); + } + if (!pt.isNull()) { + QualType const pPointee(pt.getUnqualifiedType().getCanonicalType()); auto const iter(std::find(rParents.begin(), rParents.end(), pPointee)); if (iter == rParents.end()) { std::vector<QualType> copy(rParents); - copy.push_back(pCanonical); - return isBadStaticType(pPointee, chain, copy); + copy.push_back(rpType.getUnqualifiedType().getCanonicalType()); + return isBadStaticType(pt, chain, copy); } else { return std::make_pair(false, std::vector<FieldDecl const*>()); } } - RecordType const*const pRecordType(pCanonical->getAs<RecordType>()); + RecordType const*const pRecordType(rpType->getAs<RecordType>()); if (!pRecordType) { return std::make_pair(false, std::vector<FieldDecl const*>()); } @@ -56,6 +65,44 @@ public: { return std::make_pair(true, chain); } + if (type.Class("array").StdNamespace() + || type.Class("deque").StdNamespace() + || type.Class("forward_list").StdNamespace() + || type.Class("initializer_list").StdNamespace() + || type.Class("list").StdNamespace() + || type.Class("multiset").StdNamespace() + || type.Class("set").StdNamespace() + || type.Class("unordered_multiset").StdNamespace() + || type.Class("unordered_set").StdNamespace() + || type.Class("vector").StdNamespace()) + { + std::vector<QualType> copy(rParents); + copy.push_back(rpType.getUnqualifiedType().getCanonicalType()); + auto ctsd = dyn_cast<ClassTemplateSpecializationDecl>( + pRecordType->getDecl()); + assert(ctsd != nullptr); + auto const & args = ctsd->getTemplateArgs(); + assert(args.size() >= 1); + return isBadStaticType(args.get(0).getAsType(), chain, copy); + } + if (type.Class("map").StdNamespace() + || type.Class("multimap").StdNamespace() + || type.Class("unordered_map").StdNamespace() + || type.Class("unordered_multimap").StdNamespace()) + { + std::vector<QualType> copy(rParents); + copy.push_back(rpType.getUnqualifiedType().getCanonicalType()); + auto ctsd = dyn_cast<ClassTemplateSpecializationDecl>( + pRecordType->getDecl()); + assert(ctsd != nullptr); + auto const & args = ctsd->getTemplateArgs(); + assert(args.size() >= 2); + auto ret = isBadStaticType(args.get(0).getAsType(), chain, copy); + if (ret.first) { + return ret; + } + return isBadStaticType(args.get(1).getAsType(), chain, copy); + } RecordDecl const*const pDefinition(pRecordType->getDecl()->getDefinition()); if (!pDefinition) { // maybe no definition if it's a pointer/reference return std::make_pair(false, std::vector<FieldDecl const*>()); @@ -70,7 +117,7 @@ public: return std::make_pair(false, std::vector<FieldDecl const*>()); } std::vector<QualType> copy(rParents); - copy.push_back(pCanonical); + copy.push_back(rpType.getUnqualifiedType().getCanonicalType()); CXXRecordDecl const*const pDecl(dyn_cast<CXXRecordDecl>(pDefinition)); assert(pDecl); for (auto it = pDecl->field_begin(); it != pDecl->field_end(); ++it) { commit 160478912af18a268c72907e6fd49bf6d95f0af2 Author: Stephan Bergmann <sberg...@redhat.com> Date: Sat Oct 8 23:49:29 2016 +0200 loplugin:badstatics ScAddInListener has a member ScAddInDocs* pDocs; // documents where this is used where ScAddInDocs is set<ScDocument*>, and ScDocument has a memmber VclPtr<SfxPrinter> pPrinter; so that's only a chain of (apparently non-owning) pointers. Change-Id: I050218320eb2c588dcfaee80225f4e45a515ed32 Reviewed-on: https://gerrit.libreoffice.org/29613 Reviewed-by: Stephan Bergmann <sberg...@redhat.com> Tested-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index 12e6b93..db5b0dd 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -150,6 +150,8 @@ public: // ScAddInAsync* keys if that set is not empty at exit || name == "g_aWindowList" //vcl/unx/gtk/a11y/atkutil.cxx, asserted empty at exit + || (loplugin::DeclCheck(pVarDecl).Var("aAllListeners") + .Class("ScAddInListener").GlobalNamespace()) // not owning ) // these variables appear unproblematic { return true; diff --git a/compilerplugins/clang/check.hxx b/compilerplugins/clang/check.hxx index 0c2c1bb..9bfc458 100644 --- a/compilerplugins/clang/check.hxx +++ b/compilerplugins/clang/check.hxx @@ -78,6 +78,9 @@ public: ContextCheck Operator(clang::OverloadedOperatorKind op) const; + template<std::size_t N> inline ContextCheck Var(char const (& id)[N]) + const; + ContextCheck MemberFunction() const; private: @@ -198,6 +201,19 @@ template<std::size_t N> ContextCheck DeclCheck::Function(char const (& id)[N]) return ContextCheck(); } +template<std::size_t N> ContextCheck DeclCheck::Var(char const (& id)[N]) + const +{ + auto f = llvm::dyn_cast_or_null<clang::VarDecl>(decl_); + if (f != nullptr) { + auto const i = f->getIdentifier(); + if (i != nullptr && i->isStr(id)) { + return ContextCheck(f->getDeclContext()); + } + } + return ContextCheck(); +} + template<std::size_t N> ContextCheck ContextCheck::Namespace( char const (& id)[N]) const { commit 2994586faac6a804b2d2b910133763ceb16134a0 Author: Stephan Bergmann <sberg...@redhat.com> Date: Sat Oct 8 23:45:40 2016 +0200 loplugin:badstatics ...so make aPostedEventList a member of the global ImpSVAppData singleton Change-Id: Ie7ac49b56107eb393514d9ba1d91ee66296f60a0 Reviewed-on: https://gerrit.libreoffice.org/29612 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index c82bace..ded416e 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -34,9 +34,11 @@ #include "salwtype.hxx" #include "displayconnectiondispatch.hxx" +#include <list> #include <unordered_map> #include <boost/functional/hash.hpp> +struct ImplPostEventData; struct ImplTimerData; struct ImplIdleData; struct ImplConfigData; @@ -97,6 +99,8 @@ public: typedef std::vector<Link<VclWindowEvent&,bool> > SVAppKeyListeners; +typedef std::pair<VclPtr<vcl::Window>, ImplPostEventData *> ImplPostEventPair; + struct ImplSVAppData { enum ImeStatusWindowMode @@ -106,40 +110,41 @@ struct ImplSVAppData ImeStatusWindowMode_SHOW }; - AllSettings* mpSettings; // Application settings - LocaleConfigurationListener* mpCfgListener; - VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) - SVAppKeyListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) - ImplAccelManager* mpAccelMgr; // Accelerator Manager - OUString* mpAppName; // Application name - OUString* mpAppFileName; // Abs. Application FileName - OUString* mpDisplayName; // Application Display Name - OUString* mpToolkitName; // Toolkit Name - Help* mpHelp; // Application help + AllSettings* mpSettings = nullptr; // Application settings + LocaleConfigurationListener* mpCfgListener = nullptr; + VclEventListeners* mpEventListeners = nullptr; // listeners for vcl events (eg, extended toolkit) + SVAppKeyListeners* mpKeyListeners = nullptr; // listeners for key events only (eg, extended toolkit) + std::list<ImplPostEventPair> maPostedEventList; + ImplAccelManager* mpAccelMgr = nullptr; // Accelerator Manager + OUString* mpAppName = nullptr; // Application name + OUString* mpAppFileName = nullptr; // Abs. Application FileName + OUString* mpDisplayName = nullptr; // Application Display Name + OUString* mpToolkitName = nullptr; // Toolkit Name + Help* mpHelp = nullptr; // Application help VclPtr<PopupMenu> mpActivePopupMenu; // Actives Popup-Menu (in Execute) VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow - ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung - ImplEventHook* mpFirstEventHook; // Event-Hooks - sal_uInt64 mnLastInputTime; // GetLastInputTime() - sal_uInt16 mnDispatchLevel; // DispatchLevel - sal_uInt16 mnModalMode; // ModalMode Count - SystemWindowFlags mnSysWinMode; // Mode, when SystemWindows should be created - bool mbInAppMain; // is Application::Main() on stack - bool mbInAppExecute; // is Application::Execute() on stack - bool mbAppQuit; // is Application::Quit() called - bool mbSettingsInit; // true: Settings are initialized - Application::DialogCancelMode meDialogCancel; // true: All Dialog::Execute() calls will be terminated immediately with return false + ImplHotKey* mpFirstHotKey = nullptr; // HotKey-Verwaltung + ImplEventHook* mpFirstEventHook = nullptr; // Event-Hooks + sal_uInt64 mnLastInputTime = 0; // GetLastInputTime() + sal_uInt16 mnDispatchLevel = 0; // DispatchLevel + sal_uInt16 mnModalMode = 0; // ModalMode Count + SystemWindowFlags mnSysWinMode = SystemWindowFlags(0); // Mode, when SystemWindows should be created + bool mbInAppMain = false; // is Application::Main() on stack + bool mbInAppExecute = false; // is Application::Execute() on stack + bool mbAppQuit = false; // is Application::Quit() called + bool mbSettingsInit = false; // true: Settings are initialized + Application::DialogCancelMode meDialogCancel = Application::DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false /** Controls whether showing any IME status window is toggled on or off. Only meaningful if showing IME status windows can be toggled on and off externally (see Application::CanToggleImeStatusWindow). */ - ImeStatusWindowMode meShowImeStatusWindow; + ImeStatusWindowMode meShowImeStatusWindow = ImeStatusWindowMode_UNKNOWN; - SvFileStream* mpEventTestInput; - Idle* mpEventTestingIdle; - int mnEventTestLimit; + SvFileStream* mpEventTestInput = nullptr; + Idle* mpEventTestingIdle = nullptr; + int mnEventTestLimit = 0; DECL_STATIC_LINK(ImplSVAppData, ImplQuitMsg, void*, void); DECL_STATIC_LINK(ImplSVAppData, ImplPrepareExitMsg, void*, void); @@ -161,19 +166,19 @@ struct ImplSVGDIData VclPtr<OutputDevice> mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics VclPtr<VirtualDevice> mpFirstVirDev; // First VirtualDevice VclPtr<VirtualDevice> mpLastVirDev; // Last VirtualDevice - OpenGLContext* mpFirstContext; // First OpenGLContext - OpenGLContext* mpLastContext; // Last OpenGLContext + OpenGLContext* mpFirstContext = nullptr; // First OpenGLContext + OpenGLContext* mpLastContext = nullptr; // Last OpenGLContext VclPtr<Printer> mpFirstPrinter; // First Printer VclPtr<Printer> mpLastPrinter; // Last Printer - ImplPrnQueueList* mpPrinterQueueList; // List of all printer queue - PhysicalFontCollection* mpScreenFontList; // Screen-Font-List - ImplFontCache* mpScreenFontCache; // Screen-Font-Cache - ImplDirectFontSubstitution* mpDirectFontSubst; // Font-Substitutons defined in Tools->Options->Fonts - GraphicConverter* mpGrfConverter; // Converter for graphics - long mnAppFontX; // AppFont X-Numenator for 40/tel Width - long mnAppFontY; // AppFont Y-Numenator for 80/tel Height - bool mbFontSubChanged; // true: FontSubstitution was changed between Begin/End - bool mbNativeFontConfig; // true: do not override UI font + ImplPrnQueueList* mpPrinterQueueList = nullptr; // List of all printer queue + PhysicalFontCollection* mpScreenFontList = nullptr; // Screen-Font-List + ImplFontCache* mpScreenFontCache = nullptr; // Screen-Font-Cache + ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutons defined in Tools->Options->Fonts + GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics + long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width + long mnAppFontY = 0; // AppFont Y-Numenator for 80/tel Height + bool mbFontSubChanged = false; // true: FontSubstitution was changed between Begin/End + bool mbNativeFontConfig = false; // true: do not override UI font }; struct ImplSVWinData @@ -188,56 +193,56 @@ struct ImplSVWinData VclPtr<Dialog> mpLastExecuteDlg; // First Dialog that is in Execute VclPtr<vcl::Window> mpExtTextInputWin; // Window, which is in ExtTextInput VclPtr<vcl::Window> mpTrackWin; // window, that is in tracking mode - AutoTimer* mpTrackTimer; // tracking timer - ImageList* mpMsgBoxImgList; // ImageList for MessageBox + AutoTimer* mpTrackTimer = nullptr; // tracking timer + ImageList* mpMsgBoxImgList = nullptr; // ImageList for MessageBox VclPtr<vcl::Window> mpAutoScrollWin; // window, that is in AutoScrollMode mode VclPtr<vcl::Window> mpLastWheelWindow; // window, that last received a mouse wheel event SalWheelMouseEvent maLastWheelEvent; // the last received mouse whell event - StartTrackingFlags mnTrackFlags; // tracking flags - StartAutoScrollFlags mnAutoScrollFlags; // auto scroll flags - bool mbNoDeactivate; // true: do not execute Deactivate - bool mbNoSaveFocus; // true: menus must not save/restore focus + StartTrackingFlags mnTrackFlags = StartTrackingFlags::NONE; // tracking flags + StartAutoScrollFlags mnAutoScrollFlags = StartAutoScrollFlags::NONE; // auto scroll flags + bool mbNoDeactivate = false; // true: do not execute Deactivate + bool mbNoSaveFocus = false; // true: menus must not save/restore focus }; typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList; struct ImplSVCtrlData { - ImageList* mpCheckImgList; // ImageList for CheckBoxes - ImageList* mpRadioImgList; // ImageList for RadioButtons - ImageList* mpPinImgList; // ImageList for PIN - ImageList* mpSplitHPinImgList; // ImageList for Horizontale SplitWindows - ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's) - Image* mpDisclosurePlus; - Image* mpDisclosureMinus; - ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox - sal_uInt16 mnCheckStyle; // CheckBox-Style for ImageList-Update - sal_uInt16 mnRadioStyle; // Radio-Style for ImageList-Update - sal_uLong mnLastCheckFColor; // Letzte FaceColor fuer CheckImage - sal_uLong mnLastCheckWColor; // Letzte WindowColor fuer CheckImage - sal_uLong mnLastCheckLColor; // Letzte LightColor fuer CheckImage - sal_uLong mnLastRadioFColor; // Letzte FaceColor fuer RadioImage - sal_uLong mnLastRadioWColor; // Letzte WindowColor fuer RadioImage - sal_uLong mnLastRadioLColor; // Letzte LightColor fuer RadioImage - FieldUnitStringList* mpFieldUnitStrings; // list with field units - FieldUnitStringList* mpCleanUnitStrings; // same list but with some "fluff" like spaces removed + ImageList* mpCheckImgList = nullptr; // ImageList for CheckBoxes + ImageList* mpRadioImgList = nullptr; // ImageList for RadioButtons + ImageList* mpPinImgList = nullptr; // ImageList for PIN + ImageList* mpSplitHPinImgList = nullptr; // ImageList for Horizontale SplitWindows + ImageList* mpSplitVPinImgList = nullptr; // ImageList for Vertikale SplitWindows (PIN's) + Image* mpDisclosurePlus = nullptr; + Image* mpDisclosureMinus = nullptr; + ImplTBDragMgr* mpTBDragMgr = nullptr; // DragMgr for ToolBox + sal_uInt16 mnCheckStyle = 0; // CheckBox-Style for ImageList-Update + sal_uInt16 mnRadioStyle = 0; // Radio-Style for ImageList-Update + sal_uLong mnLastCheckFColor = 0; // Letzte FaceColor fuer CheckImage + sal_uLong mnLastCheckWColor = 0; // Letzte WindowColor fuer CheckImage + sal_uLong mnLastCheckLColor = 0; // Letzte LightColor fuer CheckImage + sal_uLong mnLastRadioFColor = 0; // Letzte FaceColor fuer RadioImage + sal_uLong mnLastRadioWColor = 0; // Letzte WindowColor fuer RadioImage + sal_uLong mnLastRadioLColor = 0; // Letzte LightColor fuer RadioImage + FieldUnitStringList* mpFieldUnitStrings = nullptr; // list with field units + FieldUnitStringList* mpCleanUnitStrings = nullptr; // same list but with some "fluff" like spaces removed }; struct ImplSVHelpData { - bool mbContextHelp; // is ContextHelp enabled - bool mbExtHelp; // is ExtendedHelp enabled - bool mbExtHelpMode; // is in ExtendedHelp Mode - bool mbOldBalloonMode; // BalloonMode, before ExtHelpMode started - bool mbBalloonHelp; // is BalloonHelp enabled - bool mbQuickHelp; // is QuickHelp enabled - bool mbSetKeyboardHelp; // tiphelp was activated by keyboard - bool mbKeyboardHelp; // tiphelp was activated by keyboard - bool mbAutoHelpId; // generate HelpIds - bool mbRequestingHelp; // In Window::RequestHelp + bool mbContextHelp = false; // is ContextHelp enabled + bool mbExtHelp = false; // is ExtendedHelp enabled + bool mbExtHelpMode = false; // is in ExtendedHelp Mode + bool mbOldBalloonMode = false; // BalloonMode, before ExtHelpMode started + bool mbBalloonHelp = false; // is BalloonHelp enabled + bool mbQuickHelp = false; // is QuickHelp enabled + bool mbSetKeyboardHelp = false; // tiphelp was activated by keyboard + bool mbKeyboardHelp = false; // tiphelp was activated by keyboard + bool mbAutoHelpId = true; // generate HelpIds + bool mbRequestingHelp = false; // In Window::RequestHelp VclPtr<HelpTextWindow> mpHelpWin; // HelpWindow - sal_uInt64 mnLastHelpHideTime; // ticks of last show + sal_uInt64 mnLastHelpHideTime = 0; // ticks of last show }; // "NWF" means "Native Widget Framework" and was the term used for the @@ -247,38 +252,38 @@ struct ImplSVHelpData struct ImplSVNWFData { - int mnStatusBarLowerRightOffset; // amount in pixel to avoid in the lower righthand corner - int mnMenuFormatBorderX; // horizontal inner popup menu border - int mnMenuFormatBorderY; // vertical inner popup menu border - int mnMenuSeparatorBorderX; // gap at each side of separator - ::Color maMenuBarHighlightTextColor; // override higlight text color + int mnStatusBarLowerRightOffset = 0; // amount in pixel to avoid in the lower righthand corner + int mnMenuFormatBorderX = 0; // horizontal inner popup menu border + int mnMenuFormatBorderY = 0; // vertical inner popup menu border + int mnMenuSeparatorBorderX = 0; // gap at each side of separator + ::Color maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); // override higlight text color // in menubar if not transparent - bool mbMenuBarDockingAreaCommonBG; // e.g. WinXP default theme - bool mbDockingAreaSeparateTB; // individual toolbar backgrounds + bool mbMenuBarDockingAreaCommonBG = false; // e.g. WinXP default theme + bool mbDockingAreaSeparateTB = false; // individual toolbar backgrounds // instead of one for docking area - bool mbDockingAreaAvoidTBFrames; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false - bool mbToolboxDropDownSeparate; // two adjacent buttons for + bool mbDockingAreaAvoidTBFrames = false; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false + bool mbToolboxDropDownSeparate = false; // two adjacent buttons for // toolbox dropdown buttons - bool mbFlatMenu; // no popup 3D border - bool mbOpenMenuOnF10; // on gnome the first menu opens on F10 - bool mbNoFocusRects; // on Aqua/Gtk3 use native focus rendering, except for flat buttons - bool mbNoFocusRectsForFlatButtons; // on Gtk3 native focusing is also preferred for flat buttons - bool mbCenteredTabs; // on Aqua, tabs are centered - bool mbNoActiveTabTextRaise; // on Aqua the text for the selected tab + bool mbFlatMenu = false; // no popup 3D border + bool mbOpenMenuOnF10 = false; // on gnome the first menu opens on F10 + bool mbNoFocusRects = false; // on Aqua/Gtk3 use native focus rendering, except for flat buttons + bool mbNoFocusRectsForFlatButtons = false; // on Gtk3 native focusing is also preferred for flat buttons + bool mbCenteredTabs = false; // on Aqua, tabs are centered + bool mbNoActiveTabTextRaise = false; // on Aqua the text for the selected tab // should not "jump up" a pixel - bool mbProgressNeedsErase; // set true for platforms that should draw the + bool mbProgressNeedsErase = false; // set true for platforms that should draw the // window background before drawing the native // progress bar - bool mbCheckBoxNeedsErase; // set true for platforms that should draw the + bool mbCheckBoxNeedsErase = false; // set true for platforms that should draw the // window background before drawing the native // checkbox - bool mbCanDrawWidgetAnySize; // set to true currently on gtk + bool mbCanDrawWidgetAnySize = false; // set to true currently on gtk /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows) - bool mbDDListBoxNoTextArea; - bool mbEnableAccel; // whether or not accelerators are shown - bool mbAutoAccel; // whether accelerators are only shown when Alt is held down - bool mbRolloverMenubar; // theming engine supports rollover in menubar + bool mbDDListBoxNoTextArea = false; + bool mbEnableAccel = true; // whether or not accelerators are shown + bool mbAutoAccel = false; // whether accelerators are only shown when Alt is held down + bool mbRolloverMenubar = false; // theming engine supports rollover in menubar }; struct BlendFrameCache @@ -304,38 +309,36 @@ struct BlendFrameCache struct ImplSVData { - ImplSVData(); - - SalData* mpSalData; - SalInstance* mpDefInst; // Default SalInstance - Application* mpApp; // pApp + SalData* mpSalData = nullptr; + SalInstance* mpDefInst = nullptr; // Default SalInstance + Application* mpApp = nullptr; // pApp VclPtr<WorkWindow> mpDefaultWin; // Default-Window - bool mbDeInit; // Is VCL deinitializing - ImplSchedulerData* mpFirstSchedulerData; // list of all running tasks - SalTimer* mpSalTimer; // interface to sal event loop/timers - SalI18NImeStatus* mpImeStatus; // interface to ime status window - SalSystem* mpSalSystem; // SalSystem interface - ResMgr* mpResMgr; // SV-Resource-Manager - sal_uInt64 mnTimerPeriod; // current timer period + bool mbDeInit = false; // Is VCL deinitializing + ImplSchedulerData* mpFirstSchedulerData = nullptr; // list of all running tasks + SalTimer* mpSalTimer = nullptr; // interface to sal event loop/timers + SalI18NImeStatus* mpImeStatus = nullptr; // interface to ime status window + SalSystem* mpSalSystem = nullptr; // SalSystem interface + ResMgr* mpResMgr = nullptr; // SV-Resource-Manager + sal_uInt64 mnTimerPeriod = 0; // current timer period ImplSVAppData maAppData; // indepen data for class Application ImplSVGDIData maGDIData; // indepen data for Output classes ImplSVWinData maWinData; // indepen data for Windows classes ImplSVCtrlData maCtrlData; // indepen data for Control classes ImplSVHelpData maHelpData; // indepen data for Help classes ImplSVNWFData maNWFData; - UnoWrapperBase* mpUnoWrapper; + UnoWrapperBase* mpUnoWrapper = nullptr; VclPtr<vcl::Window> mpIntroWindow; // the splash screen - DockingManager* mpDockingManager; - BlendFrameCache* mpBlendFrameCache; - vcl::CommandInfoProvider* mpCommandInfoProvider; + DockingManager* mpDockingManager = nullptr; + BlendFrameCache* mpBlendFrameCache = nullptr; + vcl::CommandInfoProvider* mpCommandInfoProvider = nullptr; - oslThreadIdentifier mnMainThreadId; + oslThreadIdentifier mnMainThreadId = 0; rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection; css::uno::Reference< css::lang::XComponent > mxAccessBridge; - vcl::SettingsConfigItem* mpSettingsConfigItem; - std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList; - std::unordered_map< int, OUString >* mpPaperNames; + vcl::SettingsConfigItem* mpSettingsConfigItem = nullptr; + std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList = nullptr; + std::unordered_map< int, OUString >* mpPaperNames = nullptr; Link<LinkParamNone*,void> maDeInitHook; }; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index becfa0f..b394c53 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -187,10 +187,6 @@ struct ImplPostEventData ~ImplPostEventData() {} }; -typedef ::std::pair< VclPtr<vcl::Window>, ImplPostEventData* > ImplPostEventPair; - -static ::std::list< ImplPostEventPair > aPostedEventList; - Application* GetpApp() { ImplSVData* pSVData = ImplGetSVData(); @@ -917,7 +913,7 @@ ImplSVEvent * Application::PostKeyEvent( sal_uLong nEvent, vcl::Window *pWin, Ke if( nEventId ) { pPostEventData->mnEventId = nEventId; - aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); + ImplGetSVData()->maAppData.maPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); } else delete pPostEventData; @@ -950,7 +946,7 @@ ImplSVEvent * Application::PostMouseEvent( sal_uLong nEvent, vcl::Window *pWin, if( nEventId ) { pPostEventData->mnEventId = nEventId; - aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); + ImplGetSVData()->maAppData.maPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); } else delete pPostEventData; @@ -1015,14 +1011,15 @@ IMPL_STATIC_LINK( Application, PostEventHandler, void*, pCallData, void ) ImplWindowFrameProc( pData->mpWin.get()->mpWindowImpl->mpFrameWindow.get(), nEvent, pEventData ); // remove this event from list of posted events, watch for destruction of internal data - ::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() ); + auto svdata = ImplGetSVData(); + ::std::list< ImplPostEventPair >::iterator aIter( svdata->maAppData.maPostedEventList.begin() ); - while( aIter != aPostedEventList.end() ) + while( aIter != svdata->maAppData.maPostedEventList.end() ) { if( nEventId == (*aIter).second->mnEventId ) { delete (*aIter).second; - aIter = aPostedEventList.erase( aIter ); + aIter = svdata->maAppData.maPostedEventList.erase( aIter ); } else ++aIter; @@ -1034,9 +1031,10 @@ void Application::RemoveMouseAndKeyEvents( vcl::Window* pWin ) const SolarMutexGuard aGuard; // remove all events for specific window, watch for destruction of internal data - ::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() ); + auto svdata = ImplGetSVData(); + ::std::list< ImplPostEventPair >::iterator aIter( svdata->maAppData.maPostedEventList.begin() ); - while( aIter != aPostedEventList.end() ) + while( aIter != svdata->maAppData.maPostedEventList.end() ) { if( pWin == (*aIter).first ) { @@ -1044,7 +1042,7 @@ void Application::RemoveMouseAndKeyEvents( vcl::Window* pWin ) RemoveUserEvent( (*aIter).second->mnEventId ); delete (*aIter).second; - aIter = aPostedEventList.erase( aIter ); + aIter = svdata->maAppData.maPostedEventList.erase( aIter ); } else ++aIter; diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index b43f00c..74fd791 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -79,16 +79,6 @@ SalSystem* ImplGetSalSystem() return pSVData->mpSalSystem; } -ImplSVData::ImplSVData() -{ - // init global instance data - memset( this, 0, sizeof( ImplSVData ) ); - maHelpData.mbAutoHelpId = true; - maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); - maNWFData.mbEnableAccel = true; - maNWFData.mbAutoAccel = false; -} - ImplSVGDIData::~ImplSVGDIData() { // FIXME: deliberately leak any remaining OutputDevice _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits