Skip to content

Commit f12dfb0

Browse files
committed
[qtgrilo] Fix crash on callback for cancelled operation. JB#63255
GriloDatasource dtor cancels the ongoing query but the callback gets triggered anyway with cancelled status. Avoid referencing the already deleted instance. Regression on commit cf32174, the id is already cleared on cancel so guess this one got into wrong error handling branch.
1 parent ef908c6 commit f12dfb0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Diff for: declarative/griloplugin.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ GriloPlugin::GriloPlugin(QObject *parent)
4040

4141
GriloPlugin::~GriloPlugin()
4242
{
43-
4443
}
4544

4645
void GriloPlugin::registerTypes(const char *uri)

Diff for: src/grilodatasource.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,14 @@ void GriloDataSource::grilo_source_result_cb(GrlSource *source, guint op_id,
388388
Q_UNUSED(source)
389389
GriloDataSource *that = static_cast<GriloDataSource *>(user_data);
390390

391-
// We get an error if the operation has been canceled:
391+
// We get an error if the operation has been cancelled:
392392
if (error) {
393393
if (error->domain != GRL_CORE_ERROR || error->code != GRL_CORE_ERROR_OPERATION_CANCELLED) {
394394
// TODO: error reporting?
395395
qCritical() << "Operation failed" << error->message;
396-
} else {
397-
// Cancelled operation notification. Nothing else to be done.
398396
that->d->m_previouslyAddedId.clear();
397+
} else {
398+
// Cancelled operation notification. Nothing else to be done and the instance might be deleted already
399399
return;
400400
}
401401
}

0 commit comments

Comments
 (0)