Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KIO Extras
Commits
65d1896b
Commit
65d1896b
authored
Dec 14, 2021
by
Waqar Ahmed
Browse files
Fix leak in thumbnail protocol
parent
380640a5
Pipeline
#109798
passed with stage
in 2 minutes and 8 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
thumbnail/thumbnail.cpp
View file @
65d1896b
...
...
@@ -139,7 +139,6 @@ ThumbnailProtocol::ThumbnailProtocol(const QByteArray &pool, const QByteArray &a
ThumbnailProtocol
::~
ThumbnailProtocol
()
{
qDeleteAll
(
m_creators
);
m_creators
.
clear
();
}
/**
...
...
@@ -252,7 +251,7 @@ void ThumbnailProtocol::get(const QUrl &url)
}
if
(
creator
->
handleSequences
)
{
ThumbSequenceCreator
*
sequenceCreator
=
dynamic_cast
<
ThumbSequenceCreator
*>
(
creator
->
creator
);
ThumbSequenceCreator
*
sequenceCreator
=
dynamic_cast
<
ThumbSequenceCreator
*>
(
creator
->
creator
.
get
()
);
if
(
sequenceCreator
)
{
sequenceCreator
->
setSequenceIndex
(
sequenceIndex
());
...
...
@@ -266,7 +265,7 @@ void ThumbnailProtocol::get(const QUrl &url)
}
if
(
creator
->
handleSequences
)
{
ThumbSequenceCreator
*
sequenceCreator
=
dynamic_cast
<
ThumbSequenceCreator
*>
(
creator
->
creator
);
ThumbSequenceCreator
*
sequenceCreator
=
dynamic_cast
<
ThumbSequenceCreator
*>
(
creator
->
creator
.
get
()
);
// We MUST do this after calling create(), because the create() call itself might change it.
const
float
wp
=
sequenceCreator
->
sequenceIndexWraparoundPoint
();
setMetaData
(
"sequenceIndexWraparoundPoint"
,
QString
().
setNum
(
wp
));
...
...
@@ -695,7 +694,7 @@ ThumbCreatorWithMetadata* ThumbnailProtocol::getThumbCreator(const QString& plug
qCWarning
(
KIO_THUMBNAIL_LOG
)
<<
"Plugin not found:"
<<
plugin
;
}
else
{
thumbCreator
=
new
ThumbCreatorWithMetadata
{
creator
,
std
::
unique_ptr
<
ThumbCreator
>
(
creator
)
,
data
.
value
(
"CacheThumbnail"
,
true
),
data
.
value
(
"DevicePixelRatioDependent"
,
false
),
data
.
value
(
"HandleSequences"
,
false
),
...
...
@@ -847,7 +846,7 @@ bool ThumbnailProtocol::createThumbnail(ThumbCreatorWithMetadata* thumbCreator,
if
(
thumbCreator
->
devicePixelRatioDependent
)
{
KIO
::
ThumbDevicePixelRatioDependentCreator
*
dprDependentCreator
=
static_cast
<
KIO
::
ThumbDevicePixelRatioDependentCreator
*>
(
thumbCreator
->
creator
);
thumbCreator
->
creator
.
get
()
);
if
(
dprDependentCreator
)
{
dprDependentCreator
->
setDevicePixelRatio
(
m_devicePixelRatio
);
...
...
thumbnail/thumbnail.h
View file @
65d1896b
...
...
@@ -18,7 +18,7 @@ class ThumbCreator;
class
QImage
;
struct
ThumbCreatorWithMetadata
{
ThumbCreator
*
creator
=
nullptr
;
std
::
unique_ptr
<
ThumbCreator
>
creator
;
bool
cacheThumbnail
=
true
;
bool
devicePixelRatioDependent
=
false
;
bool
handleSequences
=
false
;
...
...
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