[education/rkward/releases/0.8.1] rkward/rbackend: Preload libgobject in addition to libglib

Thomas Friedrichsmeier null at kde.org
Sat Apr 19 17:24:15 BST 2025


Git commit c4409f65581aa9f8445dbf01a58356996fdccb02 by Thomas Friedrichsmeier.
Committed on 19/04/2025 at 16:22.
Pushed by tfry into branch 'releases/0.8.1'.

Preload libgobject in addition to libglib

M  +10   -0    rkward/rbackend/rkrbackend_dlopen.cpp

https://invent.kde.org/education/rkward/-/commit/c4409f65581aa9f8445dbf01a58356996fdccb02

diff --git a/rkward/rbackend/rkrbackend_dlopen.cpp b/rkward/rbackend/rkrbackend_dlopen.cpp
index e245bee55..65fec304a 100644
--- a/rkward/rbackend/rkrbackend_dlopen.cpp
+++ b/rkward/rbackend/rkrbackend_dlopen.cpp
@@ -90,11 +90,21 @@ void preloadBetterGlib(const char *cd_to) {
 		std::filesystem::current_path(cd_to);
 	}
 	auto glib2 = loadGlib(&glib2_ver);
+	if (glib1_ver < glib2_ver) {
+		// For good measure, we'll also load the matching libgobject lib, if present). (libgobject links against libglib, but not vice-versa)
+		if (!dlopen("libgobject-2.0.so", RTLD_LAZY | RTLD_LOCAL)) {
+			dlopen("libgobject-2.0.so.0", RTLD_LAZY | RTLD_LOCAL);
+		}
+	}
 	std::filesystem::current_path(cd);
 
 	if (glib1_ver >= glib2_ver) {
 		dlclose(glib2);
 		loadGlib(&glib1_ver);
+		// see above
+		if (!dlopen("libgobject-2.0.so", RTLD_LAZY | RTLD_LOCAL)) {
+			dlopen("libgobject-2.0.so.0", RTLD_LAZY | RTLD_LOCAL);
+		}
 	}
 }
 #endif



More information about the rkward-tracker mailing list