summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-05 16:41:02 +0100
committerDavid Tardon <dtardon@redhat.com>2014-06-09 16:56:26 +0000
commit460d2ffa8dd461f41f1fc77596ee0578e8ea6731 (patch)
tree8852ce02797a4f8fee49a4d8ed82c1fc7f22773c
parent9920c72a200f2a27aa52fa249784e60425972de5 (diff)
Resolves: fdo#79021 cannot delete ListBox from inside its own Select handler
Change-Id: I884e617b112397697a702216b62d0c1e17aae536 (cherry picked from commit b0a9f33a9b3018dcfb471641bde7c29a6e62f394) (cherry picked from commit 268c4907a04959ca546c5e2ecf469d4d297293b9) Reviewed-on: https://gerrit.libreoffice.org/9656 Tested-by: David Tardon <dtardon@redhat.com> Reviewed-by: David Tardon <dtardon@redhat.com>
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx10
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx1
2 files changed, 11 insertions, 0 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 907c1b629472..2f5e6f8b57c0 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -235,6 +235,16 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox)
IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox)
{
+ //Resolves: fdo#79021 At this point we are still inside the ListBox Select.
+ //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);
+ return 0;
+}
+
+IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox)
+{
EntryContainer::iterator itr = maEntries.begin();
for(; itr != maEntries.end(); ++itr)
{
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index 6baf33dd33d6..721397a7ae16 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -79,6 +79,7 @@ public:
DECL_LINK( EntrySelectHdl, ScCondFrmtEntry* );
DECL_LINK( TypeListHdl, ListBox*);
+ DECL_LINK( AfterTypeListHdl, ListBox*);
DECL_LINK( ColFormatTypeHdl, ListBox*);
};