Bug 108305 - Keyboard F4 shortcut assigned as Position and Size crashes writer
Summary: Keyboard F4 shortcut assigned as Position and Size crashes writer
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: high major
Assignee: Michael Stahl
QA Contact:
URL:
Whiteboard: target:5.5.0 target:5.4.0.1 target:5.3.5
Keywords: bibisected, haveBacktrace, regression
Depends on:
Blocks:
 
Reported: 2017-06-02 13:45 UTC by christian.rufener
Modified: 2017-06-09 19:58 UTC (History)
4 users (show)

See Also:
Crash report or crash signature: ["SfxItemSet::GetItemState(unsigned%20short,bool,SfxPoolItem%20const%20*%20*)"]


Attachments
gdb backtrace (20.65 KB, text/plain)
2017-06-02 14:24 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description christian.rufener 2017-06-02 13:45:26 UTC
Writer crashes when assigned keyboard shortcut to "Format|Position ans Size" is hit when image is selected:

To reproduce:
Open Writer
Insert an image 
Choose "Tools|Customize"
Select "Keyboard" tab
Assign "Format" "Position and Size" to "F4"
Select the inserted image
Hit "F4"
Writer crashes (restarts with recovery)
Comment 1 Xisco Faulí 2017-06-02 13:52:00 UTC
Confirmed in

Version: 5.5.0.0.alpha0+
Build ID: 9956849c2ea6049582e2ccf04c355542c1ef00a1
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

and

Versión: 5.3.3.2
Id. de compilación: 3d9a8b4b4e538a85e0782bd6c2d430bafe583448
Subproc. CPU: 1; SO: Windows 6.1; Repr. de IU: predet.; Motor de trazado: HarfBuzz; 
Configuración regional: es-ES (es_ES); Calc: group
Comment 3 Xisco Faulí 2017-06-02 14:16:17 UTC
I can also reproduce it in Apache OpenOffice  4.1.3. Thus, it was introduced by a commit cherry-picked from AOO in that range.
Comment 4 Xisco Faulí 2017-06-02 14:24:28 UTC
Created attachment 133810 [details]
gdb backtrace
Comment 5 Julien Nabet 2017-06-02 17:00:21 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Here are some gdb traces:
(gdb) frame 1
#1  0x00007fffca3c8a0b in SwFrameShell::Execute (this=0x55555c05d160, rReq=...) at /home/julien/lo/libreoffice/sw/source/uibase/shells/frmsh.cxx:353
353	            if ( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_WIDTH, false, &pItem ) )
(gdb) p pArgs
$3 = (const SfxItemSet *) 0x0
(gdb) p rReq
$4 = (SfxRequest &) @0x7fffffff2590: {<SfxHint> = {_vptr.SfxHint = 0x7ffff2722a58 <vtable for SfxRequest+16>, mnId = SfxHintId::NONE}, nSlot = 10087, pArgs = 0x0, 
  pImpl = std::unique_ptr<SfxRequest_Impl> containing 0x55555c1c4bd0}
Comment 6 Julien Nabet 2017-06-04 00:19:01 UTC
Let's increase importance since:
- it's a crash
- it impacts every env
- it's a regression
Comment 7 Commit Notification 2017-06-07 15:54:16 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#108305 sw: fix crash on fly "Position and Size"

It will be available in 5.5.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.
Comment 8 Michael Stahl 2017-06-07 15:55:32 UTC
fixed on master
Comment 9 Commit Notification 2017-06-07 19:43:56 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3a286f471c34731d777852024f40fda60aa4f016&h=libreoffice-5-4

tdf#108305 sw: fix crash on fly "Position and Size"

It will be available in 5.4.0.1.

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.
Comment 10 Julien Nabet 2017-06-08 19:19:58 UTC
With master sources updated today, I don't reproduce the crash but typing F4 does nothing (or missed something)

I noticed this line repeated several times when opening customize tool:
warn:legacy.osl:1907:1:sfx2/source/control/msgpool.cxx:150: GroupId-Name not defined in SFX!
Comment 11 Michael Stahl 2017-06-08 19:22:48 UTC
indeed it doesn't do anything without its SfxItemSet arguments, which are presumably set by whatever sidebar code usually invokes this; i have no idea if we have a way to avoid configuring keyboard shortcuts for cases like this where it doesn't make sense
Comment 12 Maxim Monastirsky 2017-06-08 21:15:45 UTC
(In reply to Michael Stahl from comment #11)
> i have no idea
> if we have a way to avoid configuring keyboard shortcuts for cases like this
> where it doesn't make sense
We do have a way. If you set all the *Config sdi properties to FALSE, the command will not appear in the XDispatchInformationProvider::getConfigurableDispatchInformation results, and therefore will not be visible in the customization dialog. But we should *not* do it in this case, because the same command works perfectly without args e.g. when a shape is selected.

Also it's worth mentioning that the command is actually disabled when an image is selected (Look under Format > Text Box and Shape menu), clearly indicating that it shouldn't be executed (at least without args)... Usually we can forbid the execution of a disabled command by setting the FastCall sdi property to FALSE. This can make the whole thing stop inside SfxDispatcher, not even entering the sw execution handler. Unfortunately this isn't possible in this case, as the sidebar clearly wants to execute that slot when it's disabled (which is odd).
Comment 13 Commit Notification 2017-06-09 19:58:21 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e64a85d50dbd4db7a3de1ee2f6caf52cc60f6a50&h=libreoffice-5-3

tdf#108305 sw: fix crash on fly "Position and Size"

It will be available in 5.3.5.

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.