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
Education
Cantor
Commits
c71ffbcb
Commit
c71ffbcb
authored
Feb 14, 2021
by
Alexander Semke
Browse files
Don't try to modify the worksheet when it's currently being destroyed.
BUG: 428611
FIXED-IN: 21.04
parent
445a475f
Pipeline
#50940
passed with stage
in 25 minutes and 42 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/cantor_part.cpp
View file @
c71ffbcb
...
...
@@ -134,7 +134,8 @@ CantorPart::CantorPart( QWidget *parentWidget, QObject *parent, const QVariantLi
if
(
!
backendName
.
isEmpty
())
{
b
=
Cantor
::
Backend
::
getBackend
(
backendName
);
qDebug
()
<<
"Backend "
<<
b
->
name
()
<<
" offers extensions: "
<<
b
->
extensions
();
if
(
b
)
qDebug
()
<<
"Backend "
<<
b
->
name
()
<<
" offers extensions: "
<<
b
->
extensions
();
}
//central widget
...
...
@@ -655,7 +656,8 @@ void CantorPart::worksheetStatusChanged(Cantor::Session::Status status)
{
qDebug
()
<<
"wsStatusChange"
<<
status
;
unsigned
int
count
=
++
m_sessionStatusCounter
;
if
(
status
==
Cantor
::
Session
::
Running
)
switch
(
status
)
{
case
Cantor
::
Session
::
Running
:
{
// Useless add a interrupt action without delay, because user physically can't interrupt fast commands
QTimer
::
singleShot
(
100
,
this
,
[
this
,
count
]
()
{
...
...
@@ -667,13 +669,19 @@ void CantorPart::worksheetStatusChanged(Cantor::Session::Status status)
setStatusMessage
(
i18n
(
"Calculating..."
));
}
});
}
else
if
(
status
==
Cantor
::
Session
::
Done
)
break
;
}
case
Cantor
::
Session
::
Done
:
{
m_evaluate
->
setText
(
i18n
(
"Evaluate Worksheet"
));
m_evaluate
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
Key_E
);
m_evaluate
->
setIcon
(
QIcon
::
fromTheme
(
QLatin1String
(
"system-run"
)));
setStatusMessage
(
i18n
(
"Ready"
));
break
;
}
case
Cantor
::
Session
::
Disable
:
setStatusMessage
(
QString
());
//clean the status bar to remove the potential "Calculating...", etc. after the session was closed
}
}
...
...
src/worksheet.cpp
View file @
c71ffbcb
...
...
@@ -111,17 +111,13 @@ Worksheet::Worksheet(Cantor::Backend* backend, QWidget* parent, bool useDeafultW
Worksheet
::~
Worksheet
()
{
m_isClosing
=
true
;
// This is necessary, because a SearchBar might access firstEntry()
// while the scene is deleted. Maybe there is a better solution to
// this problem, but I can't seem to find it.
m_firstEntry
=
nullptr
;
//disconnect from everything, no need to react on session status changes
//in the logout() when deleting the worksheet
disconnect
(
m_session
,
nullptr
,
nullptr
,
nullptr
);
if
(
m_session
&&
m_session
->
status
()
!=
Cantor
::
Session
::
Disable
)
m_session
->
logout
();
if
(
m_session
)
{
disconnect
(
m_session
,
nullptr
,
nullptr
,
nullptr
);
...
...
@@ -129,6 +125,7 @@ Worksheet::~Worksheet()
m_session
->
logout
();
m_session
->
deleteLater
();
}
if
(
m_jupyterMetadata
)
delete
m_jupyterMetadata
;
}
...
...
@@ -455,6 +452,9 @@ WorksheetView* Worksheet::worksheetView()
void
Worksheet
::
setModified
()
{
if
(
m_isClosing
)
return
;
if
(
!
m_isLoadingFromFile
)
emit
modified
();
}
...
...
src/worksheet.h
View file @
c71ffbcb
...
...
@@ -378,6 +378,7 @@ class Worksheet : public QGraphicsScene
bool
m_isPrinting
{
false
};
bool
m_isLoadingFromFile
{
false
};
bool
m_isClosing
{
false
};
bool
m_readOnly
{
false
};
Type
m_type
=
CantorWorksheet
;
...
...
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