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
Graphics
Okular
Commits
49c680fd
Commit
49c680fd
authored
Sep 23, 2020
by
Rafael Sadowski
Browse files
Fix RTTI with clang
Clang's RTTI support don't work here, use qobject_cast<> to avoid runtime crashes.
parent
aabff9db
Pipeline
#35402
passed with stage
in 19 minutes and 40 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
shell/shell.cpp
View file @
49c680fd
...
...
@@ -45,6 +45,7 @@
#include
<QMenuBar>
#include
<QMimeDatabase>
#include
<QMimeType>
#include
<QObject>
#include
<QScreen>
#include
<QTabBar>
#include
<QTabWidget>
...
...
@@ -217,7 +218,7 @@ bool Shell::openDocument(const QUrl &url, const QString &serializedOptions)
KParts
::
ReadWritePart
*
const
part
=
m_tabs
[
0
].
part
;
// Return false if we can't open new tabs and the only part is occupied
if
(
!
dynamic
_cast
<
Okular
::
ViewerInterface
*>
(
part
)
->
openNewFilesInTabs
()
&&
!
part
->
url
().
isEmpty
()
&&
!
ShellUtils
::
unique
(
serializedOptions
))
{
if
(
!
qobject
_cast
<
Okular
::
ViewerInterface
*>
(
part
)
->
openNewFilesInTabs
()
&&
!
part
->
url
().
isEmpty
()
&&
!
ShellUtils
::
unique
(
serializedOptions
))
{
return
false
;
}
...
...
@@ -237,7 +238,7 @@ bool Shell::canOpenDocs(int numDocs, int desktop)
return
false
;
KParts
::
ReadWritePart
*
const
part
=
m_tabs
[
0
].
part
;
const
bool
allowTabs
=
dynamic
_cast
<
Okular
::
ViewerInterface
*>
(
part
)
->
openNewFilesInTabs
();
const
bool
allowTabs
=
qobject
_cast
<
Okular
::
ViewerInterface
*>
(
part
)
->
openNewFilesInTabs
();
if
(
!
allowTabs
&&
(
numDocs
>
1
||
!
part
->
url
().
isEmpty
()))
return
false
;
...
...
@@ -259,7 +260,7 @@ void Shell::openUrl(const QUrl &url, const QString &serializedOptions)
applyOptionsToPart
(
activePart
,
serializedOptions
);
activePart
->
openUrl
(
url
);
}
else
{
if
(
dynamic
_cast
<
Okular
::
ViewerInterface
*>
(
activePart
)
->
openNewFilesInTabs
())
{
if
(
qobject
_cast
<
Okular
::
ViewerInterface
*>
(
activePart
)
->
openNewFilesInTabs
())
{
openNewTab
(
url
,
serializedOptions
);
}
else
{
Shell
*
newShell
=
new
Shell
(
serializedOptions
);
...
...
Write
Preview
Supports
Markdown
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