When settng the priority to the GSource, it makes the use-after-free issue.
Because, the GSource can attach to the event loop of the sub thread.
This patch removes calling g_source_set_priority() function after
calling g_source_attach().
Change-Id: Iaf9822561e44c08fb96d921b7f7ea9311c45886c
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
_E("g_unix_fd_source_new() is failed");
return;
} // LCOV_EXCL_STOP
-
- g_source_set_priority(source_, G_PRIORITY_DEFAULT);
}
gboolean AcceptedPort::UnixFdSourceFunc(gint fd, GIOCondition cond,
void MessageSendingThread::ThreadLoop() {
{
std::unique_lock<std::mutex> lock(mutex_);
- auto* source = GLib::IdleAdd(context_, NotifyOne, this);
+ auto* source =
+ GLib::IdleAddFull(context_, G_PRIORITY_HIGH, NotifyOne, this);
if (source == nullptr) {
_E("Failed to create GSource");
cond_.notify_one();
return;
}
- g_source_set_priority(source, G_PRIORITY_HIGH);
g_main_context_push_thread_default(context_);
}
conn_timer_data_ = nullptr;
return;
} // LCOV_EXCL_STOP
-
- g_source_set_priority(source, G_PRIORITY_DEFAULT);
}
void Proxy::UnsetConnTimer() {
} // LCOV_EXCL_STOP
idler_data_ = CreateWeakPtr();
- GSource* source = GLib::IdleAdd(context_, OnIdle, idler_data_);
+ GSource* source =
+ GLib::IdleAddFull(context_, G_PRIORITY_DEFAULT, OnIdle, idler_data_);
if (source == nullptr) { // LCOV_EXCL_START
_E("g_idle_source_new() is failed");
DestroyWeakPtr(idler_data_);
idler_data_ = nullptr;
return;
} // LCOV_EXCL_STOP
-
- g_source_set_priority(source, G_PRIORITY_DEFAULT);
}
void Proxy::UnsetIdler() {
_E("g_unix_fd_source_new() is failed");
return;
} // LCOV_EXCL_STOP
-
- g_source_set_priority(source_, G_PRIORITY_DEFAULT);
}
bool ProxyPort::IsDelegate() const { return is_delegate_; }
_E("g_unix_fd_source_new() is failed. fd=%d", GetFd());
return -1;
} // LCOV_EXCL_STOP
-
- g_source_set_priority(source_, G_PRIORITY_DEFAULT);
return 0;
}