View | Details | Raw Unified | Return to issue 124392
Collapse All | Expand All

(-)a/main/sfx2/source/dialog/templdlg.cxx (-5 / +21 lines)
Lines 1849-1864 sal_Bool SfxCommonTemplateDialog_Impl::Execute_Impl( Link Here
1849
1849
1850
	pItems[ nCount++ ] = 0;
1850
	pItems[ nCount++ ] = 0;
1851
1851
1852
    // This unbelievably crude technique is used to detect and handle
1853
    // destruction of this during the synchronous slot call: store a
1854
    // pointer to a local bool, initialize it to false and set that it
1855
    // to true in the destructor.
1852
    Deleted aDeleted;
1856
    Deleted aDeleted;
1853
    pbDeleted = &aDeleted;
1857
    pbDeleted = &aDeleted;
1858
1854
	sal_uInt16 nModi = pModifier ? *pModifier : 0;
1859
	sal_uInt16 nModi = pModifier ? *pModifier : 0;
1855
    const SfxPoolItem* pItem = rDispatcher.Execute(
1860
    const SfxPoolItem* pItem = rDispatcher.Execute(
1856
		nId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD | SFX_CALLMODE_MODAL,
1861
		nId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD | SFX_CALLMODE_MODAL,
1857
		pItems, nModi );
1862
		pItems, nModi );
1858
1863
1859
    // FIXME: Dialog can be destroyed while in Execute() check stack variable for dtor flag!
1864
    // FIXME: Dialog can be destroyed while in Execute() check stack variable for dtor flag!
1860
    if ( !pItem || aDeleted() )
1865
    if (aDeleted())
1866
    {
1867
        // this has been deleted in the previous synchronous slot
1868
        // call.  Exit without touching anything.
1869
        return sal_False;
1870
    }
1871
    else
1872
    {
1873
        // this has not been deleted.  Reset pbDeleted to prevent the
1874
        // destructor to access the local bool at a later and rather
1875
        // inconvenient time.  See bugs 124392 and 100110 for more information.
1876
        pbDeleted = NULL;
1877
    }
1878
    if (pItem == NULL)
1879
    {
1861
        return sal_False;
1880
        return sal_False;
1881
    }
1862
1882
1863
	if ( nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId )
1883
	if ( nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId )
1864
	{
1884
	{
Lines 1880-1889 sal_Bool SfxCommonTemplateDialog_Impl::Execute_Impl( Link Here
1880
		}
1900
		}
1881
	}
1901
	}
1882
    
1902
    
1883
    // Reset destroyed flag otherwise we use the pointer in the dtor
1884
    // where the local stack object is already destroyed. This would
1885
    // overwrite objects on the stack!! See #i100110
1886
    pbDeleted = NULL;
1887
    return sal_True;
1903
    return sal_True;
1888
}
1904
}
1889
1905

Return to issue 124392