Bug 316276 - More than one "Previewer Output" component can appear at the same time.
Summary: More than one "Previewer Output" component can appear at the same time.
Status: RESOLVED FIXED
Alias: None
Product: Plasma SDK
Classification: Plasma
Component: General (show other bugs)
Version: 1.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-07 03:48 UTC by Tianyu Zhu
Modified: 2013-10-29 10:55 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.1
Sentry Crash Report:


Attachments
Delete the old konsoleWidget when loading a new project. (429 bytes, patch)
2013-03-07 04:00 UTC, Tianyu Zhu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tianyu Zhu 2013-03-07 03:48:11 UTC
It seems that closing a project and then opening a new one does not destroy the old project's Previewer Output component. The effect is that every time a new project is loaded, a new Previewer Output is added to the window.

Reproducible: Always

Steps to Reproduce:
1. Load a plasmoid project
2. Close the project
3. Load another (maybe same) plasmoid project
Actual Results:  
Two Previewer Output components are shown at the bottom of the window.

Expected Results:  
Only one Previewer Output component should be shown.
Comment 1 Tianyu Zhu 2013-03-07 04:00:38 UTC
Created attachment 77824 [details]
Delete the old konsoleWidget when loading a new project.
Comment 2 Tianyu Zhu 2013-03-07 04:00:48 UTC
Honestly, the code should be using some RAII object to handle resources like KonsolePreviewer. For example, had the new C++11 std::unique_ptr been used instead of a raw pointers, the old KonsolePreviwer would have been deleted (and not leaked!) automatically after the new one was created.
Comment 3 Giorgos Tsiapaliokas 2013-03-07 11:32:25 UTC
Thank you for the patch.

Can you open a review at git.reviewboard.kde.org?
I would like to keep all the patches in the reviewboard
since more people will be able to see the code and receive
more feedback.