https://issues.apache.org/ooo/show_bug.cgi?id=122116
--- Comment #2 from Ariel Constenla-Haile <[email protected]> --- Slot SID_GALLERY_FORMATS is dispatched in void GalleryBrowser2::ImplExecute( sal_uInt16 nId ) main/svx/source/gallery2/galbrws2.cxx and executed in the respective shells: * sc: void ScTabViewShell::ExecGallery( SfxRequest& rReq ) sc/source/ui/view/tabvwsh9.cxx * sw: void SwBaseShell::Execute(SfxRequest &rReq) sw/source/ui/shells/basesh.cxx (there is a potential crash here, dereferencing a null pointer: the request argument is assumed to be always present) * sd: void DrawViewShell::ExecGallery(SfxRequest& rReq) sd/source/ui/view/drviews9.cxx The common work-flow is something like: GalleryExplorer* pGal = SVX_GALLERY(); if it is a graphic, get the graphic Graphic aGraphic = pGal->GetGraphic(); ... else if it is a media, get the URL ... = pGal->GetURL(); The root cause is how these member functions are implemented in GalleryExplorer /svx/inc/svx/gallery.hxx svx/source/gallery2/galexpl.cxx INetURLObject GetURL() const; String GetFilterName() const; Graphic GetGraphic() const; sal_Bool GetVCDrawModel( FmFormModel& rModel ) const; sal_Bool IsLinkage() const; // ------------------------------------------------------------------------ INetURLObject GalleryExplorer::GetURL() const { return GALLERYBROWSER()->GetURL(); } String GalleryExplorer::GetFilterName() const { return GALLERYBROWSER()->GetFilterName(); } // ------------------------------------------------------------------------ Graphic GalleryExplorer::GetGraphic() const { return GALLERYBROWSER()->GetGraphic(); } // ------------------------------------------------------------------------ sal_Bool GalleryExplorer::GetVCDrawModel( FmFormModel& rModel ) const { return GALLERYBROWSER()->GetVCDrawModel( rModel ); } // ------------------------------------------------------------------------ sal_Bool GalleryExplorer::IsLinkage() const { return GALLERYBROWSER()->IsLinkage(); } // ------------------------------------------------------------------------ The macro GALLERYBROWSER() svx/inc/svx/galbrws.hxx #define GALLERYBROWSER() ((GalleryBrowser*)( SfxViewFrame::Current()->GetChildWindow(GalleryChildWindow::GetChildWindowId())->GetWindow())) assumes that when the slot is executed, the gallery browser is opened and the slot has been executed for a gallery item select in it. With the gallery inside the gallery control of the sidebar, these assumptions are wrong: when only the sidebar's gallery control is present, and the slot is dispatched from the context menu in it, it crashes: there is no gallery child window; the GalleryControl is just a Window with the GalleryBrowser1 and GalleryBrowser2. Among the possible solutions, one could be: * change these member functions, make them static, taking a theme name and a theme item id as argument; and * change the slot definition (right now it is already wrong: it is dispatched with arguments, but defined without them): add slot arguments, for example: theme name, theme item id, gallery item format, if item is link, item URL (when link) -- You are receiving this mail because: You are on the CC list for the bug.
