Bug 98787 - Crash after showing mailmerge toolbar and showing preview
Summary: Crash after showing mailmerge toolbar and showing preview
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2.0.0.alpha0+
Hardware: All All
: high major
Assignee: Julien Nabet
URL:
Whiteboard: target:5.2.0
Keywords: haveBacktrace, regression
Depends on:
Blocks:
 
Reported: 2016-03-20 19:14 UTC by Arnaud Versini
Modified: 2016-10-25 19:08 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Crash stack trace (4.17 KB, text/plain)
2016-03-20 19:14 UTC, Arnaud Versini
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arnaud Versini 2016-03-20 19:14:18 UTC
Created attachment 123748 [details]
Crash stack trace

Step to reproduce :
- show the mailmerge toolbar,
- show the document preview,
- Writer crash on a null pointer.
Comment 1 Arnaud Versini 2016-03-20 19:15:30 UTC
Kendy, is this related to your recent modifications on mail merge ?
Comment 2 Julien Nabet 2016-03-20 19:58:54 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

This straightforward patch avoids the crash but as often, perhaps I just hide/workaround the real problem:
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 9ff9992..a492d9c 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -208,7 +208,11 @@ void SwModule::StateOther(SfxItemSet &rSet)
             case FN_MAILMERGE_LAST_ENTRY:
             {
                 SwView* pView = ::GetActiveView();
-                SwMailMergeConfigItem* pConfigItem = pView->GetMailMergeConfigItem();
+                SwMailMergeConfigItem* pConfigItem = nullptr;
+                if (pView)
+                {
+                    pConfigItem = pView->GetMailMergeConfigItem();
+                }
                 if (!pConfigItem)
                     rSet.DisableItem(nWhich);
                 else
Comment 3 Jan Holesovsky 2016-03-21 08:40:30 UTC
Julien: This looks fine to me - can you please push that?

I think ideally in the form of 

-SwMailMergeConfigItem* pConfigItem = pView->GetMailMergeConfigItem();
+SwMailMergeConfigItem* pConfigItem = pView? pView->GetMailMergeConfigItem(): nullptr;

The further code handles the 'pConfigItem == nullptr' just OK.

Thanks a lot!
Comment 4 Julien Nabet 2016-03-21 08:48:00 UTC
No pb, I'll do it tonight when I get back home :-)
Comment 5 Commit Notification 2016-03-21 20:08:30 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a79b1192c3241a350115e5a653935bb6986a9099

tdf#98787: Crash after showing mailmerge toolbar and showing preview

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.