summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2023-08-14 18:21:13 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2023-08-18 10:37:44 +0200
commitc351f920c426542f0d3685bb9df1363d3a6393f8 (patch)
tree537d3a9bbe3df1a17ca62f0cb05fbc225caaaccb /sfx2
parenta43a9dd8205f089c92737cb5519ed2a96a8d8ff2 (diff)
ITEM: preparations for more/easier changes
This change is not about speed improvements but diverse preparations to make changes/reading/understanding easier. It does not change speed AFAIK. Added a global static debug-only counter to allow getting an overview over number of all allocated SfxPoolItem's and the still alloated ones at office shutdown. The values are used in Application::~Application to make a short info statement. It allows to be able to quickly detect if an error in future changes may lead to memory losses - these would show in dramaitically higher numbers then (hopefully) immediately. Moved SfxVoidItem to own source/header. Added container library interface support to SfxItemSet, adapted already some methods to use it - not all possible, I will commit & get status from gerrit 1st if all still works and then continue. Changed INVALID_POOL_ITEM from -1 to use a global unique incarnation of an isolated derivation from SfxPoolItem. It allows to avoid the (-1) pointer hack. Since still just pointers are compared it's not worse. NOTE: That way, more 'special' SfxPoolItem's may be used for more States - a candidate is e.g. SfxVoidItem(0) which represents ::DISABLED state -- unfortunately not only, it is also used (mainly for UI stuff) with 'real' WhichIDs - hard to sort out, will have to stay that way for now AFAIK. Changed INVALID_POOL_ITEM stuff to use a static extern incarnated item in combination with a inline method to return it, called GetGlobalStaticInvalidItemInstance(). Isolated create/cleanup of a SfxPoolItem entry in SfxItemSet to further modularize/simplify that. It is currently from constructor & destructor but already shows that PoolDefaults are handled differently - probably an error. Still, for now, do no change in behaviour (yet). Got regular 'killed by the Kill-Wrapper' messages from gerrit, seems to have to do with UITest_sw_findReplace. That python/c++ scripting stuff is hard to debug, but finally I identified the problem has to do with the INVALID_POOL_ITEM change. It was in SfxItemSet::InvalidateAllItems() where still a (-1) was used -> chaos in detecting invalid items. Change-Id: I595e1f25ab660c35c4f2d19c233d1dfadfe25214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155675 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appbas.cxx1
-rw-r--r--sfx2/source/control/bindings.cxx1
-rw-r--r--sfx2/source/control/sfxstatuslistener.cxx1
-rw-r--r--sfx2/source/control/shell.cxx1
-rw-r--r--sfx2/source/control/statcach.cxx1
-rw-r--r--sfx2/source/statbar/stbitem.cxx1
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx1
-rw-r--r--sfx2/source/view/lokhelper.cxx2
8 files changed, 8 insertions, 1 deletions
diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx
index 482b93692200..1cedcd978540 100644
--- a/sfx2/source/appl/appbas.cxx
+++ b/sfx2/source/appl/appbas.cxx
@@ -28,6 +28,7 @@
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
#include <svl/whiter.hxx>
+#include <svl/voiditem.hxx>
#include <basic/sbstar.hxx>
#include <sfx2/frame.hxx>
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 629ad3aa41df..dcba259627ab 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -29,6 +29,7 @@
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
+#include <svl/voiditem.hxx>
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
#include <com/sun/star/frame/XDispatch.hpp>
diff --git a/sfx2/source/control/sfxstatuslistener.cxx b/sfx2/source/control/sfxstatuslistener.cxx
index 7cc4e8dd688b..b7e76cdff7c3 100644
--- a/sfx2/source/control/sfxstatuslistener.cxx
+++ b/sfx2/source/control/sfxstatuslistener.cxx
@@ -23,6 +23,7 @@
#include <svl/stritem.hxx>
#include <svl/intitem.hxx>
#include <svl/visitem.hxx>
+#include <svl/voiditem.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
#include <vcl/svapp.hxx>
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index aeba636a491f..5cba99c231d5 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -25,6 +25,7 @@
#include <osl/diagnose.h>
#include <svl/itempool.hxx>
#include <svl/setitem.hxx>
+#include <svl/voiditem.hxx>
#include <svl/undo.hxx>
#include <itemdel.hxx>
#include <svtools/asynclink.hxx>
diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx
index 03f1daa5a370..cf059affbed1 100644
--- a/sfx2/source/control/statcach.cxx
+++ b/sfx2/source/control/statcach.cxx
@@ -31,6 +31,7 @@
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
#include <svl/visitem.hxx>
+#include <svl/voiditem.hxx>
#include <sfx2/app.hxx>
#include <statcach.hxx>
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index e9d8512fa832..2387557d6ba9 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -18,6 +18,7 @@
*/
#include <svl/stritem.hxx>
+#include <svl/voiditem.hxx>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 70bd2b2762de..f355806aaa00 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -39,6 +39,7 @@
#include <svl/stritem.hxx>
#include <svl/intitem.hxx>
#include <svl/visitem.hxx>
+#include <svl/voiditem.hxx>
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 524bf7f7efda..a6d9ef825e35 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -558,7 +558,7 @@ namespace {
void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem)
{
- if (!pShell || !pItem || pItem == INVALID_POOL_ITEM || DisableCallbacks::disabled())
+ if (!pShell || !pItem || IsInvalidItem(pItem) || DisableCallbacks::disabled())
return;
boost::property_tree::ptree aItem = pItem->dumpAsJSON();