summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-04-15 12:27:55 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-04-15 13:27:05 +0200
commitae3342857350c805f536c1af2f560a117be12da8 (patch)
tree8f3043a2ec69c503dd385014cb8763bd6f13951a /sw
parent98f8e3a94a1b0346311dbd5eb1d0d6206eaa13e7 (diff)
sw: avoid calling SwView::GetWrtShell() unconditionally from the SwView ctor
Regression from commit dfcfdf47b5da6a11b2c3118a0f63cc48c10c2cd7 (lok: get spelling context menu on long press, 2019-10-20), the problem was that GetWrtShell() returns a reference, and the underlying pointer can be nullptr till the SwView ctor is in progress. Fix the problem by not caring about spelling till the initial view is ready, that still provides the cursor position. Change-Id: I5580a1b36b83e0a4cb8495f41e7087c784f6c83c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92256 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/tiledrendering/data/fieldmark.docxbin0 -> 13174 bytes
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx8
-rw-r--r--sw/source/core/crsr/viscrs.cxx2
3 files changed, 9 insertions, 1 deletions
diff --git a/sw/qa/extras/tiledrendering/data/fieldmark.docx b/sw/qa/extras/tiledrendering/data/fieldmark.docx
new file mode 100644
index 000000000000..02748bb7e182
--- /dev/null
+++ b/sw/qa/extras/tiledrendering/data/fieldmark.docx
Binary files differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index ab92e84b672c..441c06271d52 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -126,6 +126,7 @@ public:
void testLanguageStatus();
void testRedlineNotificationDuringSave();
void testHyperlink();
+ void testFieldmark();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -190,6 +191,7 @@ public:
CPPUNIT_TEST(testLanguageStatus);
CPPUNIT_TEST(testRedlineNotificationDuringSave);
CPPUNIT_TEST(testHyperlink);
+ CPPUNIT_TEST(testFieldmark);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2502,6 +2504,12 @@ void SwTiledRenderingTest::testHyperlink()
CPPUNIT_ASSERT_EQUAL(OString("http://example.com/"), m_sHyperlinkLink);
}
+void SwTiledRenderingTest::testFieldmark()
+{
+ // Without the accompanying fix in place, this crashed on load.
+ createDoc("fieldmark.docx");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index bf764a12db94..d51471057b4e 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -230,7 +230,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell)
// is cursor at a misspelled word ?
bool bIsWrong = false;
- if (pView)
+ if (pView && pView->GetWrtShellPtr())
{
const SwViewOption* pVOpt = pView->GetWrtShell().GetViewOptions();
if(pVOpt && pVOpt->IsOnlineSpell())