Kaydet (Commit) 36b25a83 authored tarafından Matthew J. Francis's avatar Matthew J. Francis Kaydeden (comit) Noel Grandin

fdo#85185 Copy OUString argument to avoid a use after free

The original OUString is destroyed along with its containing
object part way through the call to PaletteManager::PopupColorPicker(),
so a copy must be taken

Change-Id: I8417ff23a17003e80a4f65e0cf1ad2a8dda5386c
Reviewed-on: https://gerrit.libreoffice.org/12031Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst bd4e81ba
......@@ -197,6 +197,8 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater)
void PaletteManager::PopupColorPicker(const OUString& aCommand)
{
// The calling object goes away during aColorDlg.Execute(), so we must copy this
OUString aCommandCopy = aCommand;
SvColorDialog aColorDlg( 0 );
aColorDlg.SetColor ( mLastColor );
aColorDlg.SetMode( svtools::ColorPickerMode_MODIFY );
......@@ -206,7 +208,7 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand)
mpBtnUpdater->Update( aColorDlg.GetColor() );
mLastColor = aColorDlg.GetColor();
AddRecentColor( mLastColor );
DispatchColorCommand(aCommand, mLastColor);
DispatchColorCommand(aCommandCopy, mLastColor);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment