Issue 113992 - Backup ChartModel object leaks when opening chart dialog
Summary: Backup ChartModel object leaks when opening chart dialog
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: chart (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P2 Trivial (vote)
Target Milestone: ---
Assignee: zhang jianfang
QA Contact: issues@graphics
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-19 14:55 UTC by zhang jianfang
Modified: 2017-05-20 11:41 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
patch file fix the problem (546 bytes, patch)
2010-08-19 14:56 UTC, zhang jianfang
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description zhang jianfang 2010-08-19 14:55:50 UTC
This is another obvious leak from chart module we recently identified.

Below is the steps to recreate the memory leak,
  1. new a sc document
  2. insert a chart, it then shows the chart dialog, then click finish. After
that click on any cells to switch from inplace frame mode back to normal edit view
  3. close the doc


The callstack which creates the leaked object is,

	chartmodelmi!chart::ChartModel::createClone+0000002C
(z:\calc\chart2\source\model\main\chartmodel.cxx, 880)
	chartcontrollermi!chart::DialogModel::createBackup+000000D0
(z:\calc\chart2\source\controller\dialogs\dialogmodel.cxx, 798)
	chartcontrollermi!chart::DialogModel::DialogModel+00000143
(z:\calc\chart2\source\controller\dialogs\dialogmodel.cxx, 387)
	chartcontrollermi!chart::CreationWizard::CreationWizard+0000020C
(z:\calc\chart2\source\controller\dialogs\dlg_creationwizard.cxx, 99)
	chartcontrollermi!chart::CreationWizardUnoDlg::createDialogOnDemand+00000256
(z:\calc\chart2\source\controller\dialogs\dlg_creationwizard_uno.cxx, 240)
	chartcontrollermi!chart::CreationWizardUnoDlg::getPropertyValue+0000032B
(z:\calc\chart2\source\controller\dialogs\dlg_creationwizard_uno.cxx, 393)
	scmi!FuInsertChart::FuInsertChart+00001477
(z:\calc\sc\source\ui\drawfunc\fuins2.cxx, 752)
	scmi!ScTabViewShell::ExecDrawIns+000002DD
(z:\calc\sc\source\ui\view\tabvwshb.cxx, 373)
	scmi!SfxStubScTabViewShellExecDrawIns+0000000F
(z:\calc\sc\wntmsci10.pro\inc\scslots.hxx, 1258)
	sfxmi!SfxDispatcher::Call_Impl+000004AF
(z:\lib\sfx2\source\control\dispatch.cxx, 306)
	sfxmi!SfxDispatcher::PostMsgHandler+000000DE
(z:\lib\sfx2\source\control\dispatch.cxx, 1619)
	sfxmi!SfxDispatcher::LinkStubPostMsgHandler+0000000F
(z:\lib\sfx2\source\control\dispatch.cxx, 1579)
	tlmi!Link::Call+00000022 (z:\lib\tools\inc\tools\link.hxx, 142)
	sfxmi!SfxHintPoster::Event+0000003A (z:\lib\sfx2\source\notify\hintpost.cxx, 93)
	sfxmi!SfxHintPoster::LinkStubDoEvent_Impl+00000012
(z:\lib\sfx2\source\notify\hintpost.cxx, 87)
	tlmi!Link::Call+00000022 (z:\lib\tools\inc\tools\link.hxx, 142)
	vclmi!ImplHandleUserEvent+000000AC (z:\lib\vcl\source\window\winproc.cxx, 2024)
	vclmi!ImplWindowFrameProc+00000635 (z:\lib\vcl\source\window\winproc.cxx, 2613)
	vclmi!ImplHandleUserEvent+00000042 (z:\lib\vcl\win\source\window\salframe.cxx,
4804)
	vclmi!SalFrameWndProc+0000081E (z:\lib\vcl\win\source\window\salframe.cxx, 6463)
	vclmi!SalFrameWndProcW+00000054 (z:\lib\vcl\win\source\window\salframe.cxx, 6686)
	USER32!InternalCallWinProc+00000028
	USER32!UserCallWinProcCheckWow+00000150
	USER32!DispatchMessageWorker+00000306
	USER32!DispatchMessageW+0000000F
	vclmi!ImplDispatchMessage+00000016 (z:\lib\vcl\win\source\app\saldata.cxx, 189)
	vclmi!ImplSalDispatchMessage+00000037 (z:\lib\vcl\win\source\app\salinst.cxx, 71


The root cause of this leak is,

DialogModel.xBackupChartDocument is created in DialogModel constructor API with
api DialogModel.createBackup(). While in it's Dtor, xBackupChartDocument is not
completely released because of cyclic reference inside ChartModel object.
Normally before it is released, xBackupChartDocument.dispose() should be called
first to break the cyclic reference, but this call is missing.
Comment 1 zhang jianfang 2010-08-19 14:56:21 UTC
Created attachment 71192 [details]
patch file fix the problem
Comment 2 IngridvdM 2010-08-19 16:38:29 UTC
Thanks zhangjfibm! Looking at member m_xBackupChartDocument at class DialogModel
I found that it is completely unused at least on current code line (dev300m86).
So I have removed the member and creation of backup together with the leak.
Fixed in CWS chart49.
http://hg.services.openoffice.org/cws/chart49/rev/3d0c1b423fbd
Comment 3 IngridvdM 2010-10-08 17:10:23 UTC
zhangjfibm, please verify in CWS chart49. Thanks!
Comment 4 zhang jianfang 2010-10-09 01:36:16 UTC
verified, thank you.
Comment 5 zhang jianfang 2010-10-11 12:51:08 UTC
reopen it because wrongly closed.
Comment 6 zhang jianfang 2010-10-11 12:51:56 UTC
change state because it was wrongly closed.
Comment 7 zhang jianfang 2010-10-11 12:52:33 UTC
Mark it as verified.