Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
41e92823
Commit
41e92823
authored
Mar 23, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(src/app/App): avoid memory leaks (system tray icon, qml file selector)
parent
9d1f1d37
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
App.cpp
linphone-desktop/src/app/App.cpp
+9
-13
App.hpp
linphone-desktop/src/app/App.hpp
+3
-0
No files found.
linphone-desktop/src/app/App.cpp
View file @
41e92823
...
...
@@ -90,6 +90,7 @@ App::~App () {
qInfo
()
<<
"Destroying app..."
;
delete
m_calls_window
;
delete
m_settings_window
;
delete
m_system_tray_icon
;
}
// -----------------------------------------------------------------------------
...
...
@@ -100,11 +101,7 @@ void App::initContentApp () {
qInfo
()
<<
"Activated selectors:"
<<
QQmlFileSelector
::
get
(
&
m_engine
)
->
selector
()
->
allSelectors
();
// Provide `+custom` folders for custom components.
{
QQmlFileSelector
*
file_selector
=
new
QQmlFileSelector
(
&
m_engine
);
file_selector
=
new
QQmlFileSelector
(
&
m_engine
);
file_selector
->
setExtraSelectors
(
QStringList
(
"custom"
));
}
(
new
QQmlFileSelector
(
&
m_engine
,
this
))
->
setExtraSelectors
(
QStringList
(
"custom"
));
// Set modules paths.
m_engine
.
addImportPath
(
":/ui/modules"
);
...
...
@@ -332,10 +329,8 @@ void App::registerTypes () {
// -----------------------------------------------------------------------------
void
App
::
setTrayIcon
()
{
QSystemTrayIcon
*
m_system_tray_icon
=
new
QSystemTrayIcon
();
QQuickWindow
*
root
=
getMainWindow
();
QMenu
*
menu
=
new
QMenu
();
QSystemTrayIcon
*
system_tray_icon
=
new
QSystemTrayIcon
(
root
);
// trayIcon: Right click actions.
QAction
*
quit_action
=
new
QAction
(
"Quit"
,
root
);
...
...
@@ -345,8 +340,9 @@ void App::setTrayIcon () {
root
->
connect
(
restore_action
,
&
QAction
::
triggered
,
root
,
&
QQuickWindow
::
showNormal
);
// trayIcon: Left click actions.
QMenu
*
menu
=
new
QMenu
();
root
->
connect
(
system_tray_icon
,
&
QSystemTrayIcon
::
activated
,
[
root
](
m_
system_tray_icon
,
&
QSystemTrayIcon
::
activated
,
[
root
](
QSystemTrayIcon
::
ActivationReason
reason
)
{
if
(
reason
==
QSystemTrayIcon
::
Trigger
)
{
...
...
@@ -363,10 +359,10 @@ void App::setTrayIcon () {
menu
->
addSeparator
();
menu
->
addAction
(
quit_action
);
system_tray_icon
->
setContextMenu
(
menu
);
system_tray_icon
->
setIcon
(
QIcon
(
WINDOW_ICON_PATH
));
system_tray_icon
->
setToolTip
(
"Linphone"
);
system_tray_icon
->
show
();
m_
system_tray_icon
->
setContextMenu
(
menu
);
m_
system_tray_icon
->
setIcon
(
QIcon
(
WINDOW_ICON_PATH
));
m_
system_tray_icon
->
setToolTip
(
"Linphone"
);
m_
system_tray_icon
->
show
();
}
// -----------------------------------------------------------------------------
...
...
linphone-desktop/src/app/App.hpp
View file @
41e92823
...
...
@@ -33,6 +33,7 @@
// =============================================================================
class
DefaultTranslator
;
class
QSystemTrayIcon
;
class
App
:
public
SingleApplication
{
Q_OBJECT
;
...
...
@@ -100,6 +101,8 @@ private:
QQuickWindow
*
m_calls_window
=
nullptr
;
QQuickWindow
*
m_settings_window
=
nullptr
;
QSystemTrayIcon
*
m_system_tray_icon
=
nullptr
;
};
#endif // APP_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment