Questions tagged [glib]
GLib is a general-purpose and cross-platform utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on.
1,537
questions
0
votes
0
answers
48
views
How do I insert a string in a struct that is on an hashtable
typedef struct user {
char* id; //username
char* name;
char* email;
char* phone_number;
char* birth_date;
char* sex; // M e F
char* passport; // e.g: LK12938
char* ...
0
votes
0
answers
29
views
Write into stdin, read from stdout Subprocess/Process in Glib/GTK Vala
I have a test bash/sh script. It simply shows a question and reads answer from console, then it shows output:
#!/bin/bash
# Ask the user for their name
echo Hello, who am I talking to?
read varname
...
-2
votes
1
answer
46
views
GStreamer: TLS/SSL support not available; install glib-networking
I'm trying to make a secure WebRTC connection using GStreamer 1.22 on macOS, based on this example. When trying to connect to the signaling server via wss://, I get the following error:
HTTP/1.1 6 ...
0
votes
2
answers
58
views
Cannot include Libnm and Glib properly
I tried to use libnm for a small hobby-tool. (a cli tool e. g. for connecting via ssid with a network)
To my setup: I use fedora linux and installed NetworkManager-libnm-devel. (glib was already ...
0
votes
0
answers
43
views
Could not locate package gthread-2.0
I am trying to install the aravis project version 0.6, to display video signal through an ethernet camera whose model is HT-GE502C-T, this is compatible with genicam and gige vision protocols. For ...
0
votes
1
answer
59
views
memory leak by using g_log_structured
I would like to use Glib to achieve structured logging into the system journal of Linux (Ubuntu).
Out of three possibilities, one regularly results in a memory access error.
Unfortunately, I found ...
1
vote
0
answers
21
views
Glib Variant Tuple Deserialization
I am trying to de-serialize below Tuple, but getting issues while getting internal vector variant.
initial 2 values are retrieved but vector variant is giving me some trouble I am not able to ...
0
votes
1
answer
74
views
How to do static linking of a specific library in meson?
I am trying to build glib, which I downloaded from Github. However, library libpcre2 is dynamically linked
epatrek@seliiuts03047[12:12][babeltrace/glib/glib-2.76.5]$ ldd _build/glib/libglib-2.0.so.0
...
0
votes
2
answers
53
views
Threading OpenCV video in GTK and keep events?
I'm trying to get my camera feed into a GTK window,
and I'd like to keep the button-press-event and motion-notify-event events working.
I've found how to get the video by refreshing the image in a Gtk....
0
votes
1
answer
24
views
How to find out what sub command that fails with ninja?
I am trying to build glib with meson. The reason meson is used is simply because this is what glib supports, but I do not have much experience with it yet. The glib project is also using ninja for the ...
1
vote
2
answers
79
views
How to avoid memory leak while returning char * in C?
I have a codebase like so in C where I have a function that needs to return a char *. Is there a way to modify this code so that I can return a char * without causing a memory leak like here? Glib is ...
-1
votes
1
answer
33
views
What is the proper way to test if a capturing group captured something in g_regex_split_simple
When using glib's g_regex_split_simple, what is the best way check if a capture group actually captured anything?
#include <glib.h>
#include <stdio.h>
int main() {
char *...
0
votes
0
answers
44
views
Solving environment conflict with brew and libgio-2.0.0.dylib
I am running a python gstreamer app on mac but I get a library conflict. Here is the app:
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
from gi.repository import Gtk, Gst,...
0
votes
0
answers
63
views
Wayland XDG remote desktop portal restore_token not working in python3
I am working on a project based off of this example https://gitlab.gnome.org/-/snippets/39
I changed this function:
def on_create_session_response(response, results):
if response != 0:
...
0
votes
2
answers
49
views
How to convert a slice of GObjects as a GList to a FFI function from Rust?
I am trying to pass a GObject to a FFI function from libsecret-1 which requires it be in a GList. I have some code that almost compiles, but it complains about the lifetime of the borrowed vaue being ...
1
vote
1
answer
29
views
Exception in glib DateTime
I want to understand an error that occurs in a program. This program uses the GLib class DateTime. I want to understand what is happening there. Therefore I want to build a sample program that uses ...
0
votes
0
answers
40
views
gcc - ISO C++17 does not allow dynamic exception specifications [duplicate]
Trying to compile a program written in c++17 and depending on gtk and glibmm and I get the following error on compilation:
/usr/include/glibmm-2.4/glibmm/variant.h:498:1: error: ISO C++17 does not ...
0
votes
0
answers
38
views
Xcode has a problem linking glib as static library
I'm trying to implement glib in my c++ code as a static library, and so have linked the libglib-2.0.a file provided when installing glib through brew in the "Link Binary with libraries" ...
0
votes
0
answers
470
views
version 'GLIBCXX_3.4.29' not found
In the terminal: I open google chrome as the Default user
google-chrome-stable --profile-directory=Default
chrome opens, but the terminal outputs
/snap/core20/current/lib/x86_64-linux-gnu/libstdc++....
0
votes
0
answers
19
views
How can multiple mount points created with LIBFUSE2 be displayed in the network location or sidebar of the file manager?
I am currently working on developing a remote desktop protocol, which includes a component for network disk redirection. Instead of using common protocols like SMB, FTP, or NFS, I am implementing a ...
0
votes
1
answer
89
views
Gtk main loop and GTask
I am newer in GTK and now try to find a explonation of how GTask is working.
My main question is how in main thread I can implement a waiting all tasks finished and callbacks called before exit from ...
89
votes
5
answers
8k
views
What's the significance of a C function declaration in parentheses apparently forever calling itself?
In gatomic.c of glib there are several function declarations that look like this:
gboolean
(g_atomic_int_compare_and_exchange_full) (gint *atomic,
gint ...
0
votes
0
answers
27
views
How to make gstreamer play audio from binary data
I'm trying to play a sound effect whenever a user presses a button. The sound effect is stored in gresource at /org/Adiee5Productions/Title/rsc/sound.wav. I've never used gstreamer before and so far, ...
0
votes
0
answers
150
views
Why is there a memory leak when calling `g_bus_get_sync` in GLib?
I've got the following code that I've compiled and ran through Valgrind but g_bus_get_sync seems to leak memory. Have I done something wrong?
#include <gio/gio.h>
#include <libmm-glib.h>
...
0
votes
0
answers
34
views
Can't execute opencv imshow
Executing opencv imshow shows me following error. It worked before. I don't remember I did anything dangerous. I searched on the Internet, but haven't found similar problems. Does anyone has clue ...
0
votes
0
answers
51
views
What does @gint@ do?
I started to try and compile something and I went down a rabbit hole when I saw this error:
gitrepos/glib/glib/glibconfig.h:47:16: error: stray ‘@’ in program
47 | typedef signed @gint16@ gint16;
...
0
votes
0
answers
38
views
Dispatched lambda not reading the correct addresses?
For some context, I'm trying to build a GUI application, and at some point I need to build a widget and retrieve some data (in another thread, but for now I'm doing it in the main thread), this data ...
0
votes
1
answer
59
views
Valgrind hangs after program ends inside docker after a specific dbus call
I'm trying to use valgrind to analyze a source code for an ARM embedded board. I managed to make it work inside a docker container for most processes, but unfortunately one call of a GLIB function ...
0
votes
0
answers
37
views
Running background task GDBus
I am developing an application where I want to set network changes detector. In order to achieve that I have tried to create connection to GDBus in background thread, but i cant make it work.
Could ...
0
votes
0
answers
101
views
GTK3: opening local html file fails with Firefox as default browser in Windows
I am compiling a GTK3 program on Windows using MSYS2 (ucrt64), in which I need to open a specific html file with a local path using the default application/browser. I am using gtk_show_uri_on_window() ...
0
votes
0
answers
33
views
How to prevent endless g_object_get_qdata loop when subclassing PangoFontMap?
I'm trying to subclass PangoFontMap to read fonts in a custom format from a custom directory (the TXF format which cannot be read by FreeType2, but by OSG). I have the following code:
PangoFontOSG.hxx
...
1
vote
1
answer
139
views
Why does this function cause memory leaks?
I'm playing around with libfprint and I created a really simple function:
#include <libfprint-2/fprint.h>
#include <glib-2.0/glib-unix.h>
void start_device() {
FpContext *ctx = ...
0
votes
0
answers
53
views
Looking for something like exec() in vala
In vala, there is the command Process.spawn_command_line_sync().
But my problem is that I want to use libreoffice to convert an .odt file to .pdf. So i need all the programs in /usr/bin.
The command ...
0
votes
0
answers
59
views
Reference monitoring on GObject
What I found is:
https://docs.gtk.org/gobject/method.Object.add_toggle_ref.html
I have this problem:
When signal handler for some GtkWidget is called, I cannot delete this widget. One solution is to ...
0
votes
1
answer
52
views
porting application from Linux to Windows
I have to port a console application from Linux to Windows.
My collegue suggest to use the command:
gcc foggycsv.c -o foggycsv.exe
where foggycsv.c is the file where the code is written.
And the ...
0
votes
1
answer
79
views
How to add a float to a GList in C?
There is a great C lib called GLib.
https://docs.gtk.org/glib/index.html
I use and love this. There is a structure in it called GList which is a dinamically growing structure (like a vector).
With the ...
0
votes
0
answers
203
views
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_setspecific': Invalid argument. Aborting
My application crashes when I try to exit from application. The stack strace is as follows
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737174466624) at ./nptl/pthread_kill.c:44
#...
0
votes
1
answer
194
views
Valgrind: still reachable memory leaks found in dl-init.c. Are these real memory leaks?
Leak Summary
I'm still new to valgrind and I don't have enough knowledge to evaluate this result.
I was able to fix memory leaks in the past but the location of the leaks in my code were indicated, ...
0
votes
0
answers
26
views
Comparative performance of GList handling vs. SQLite requests
I'm dealing with a fairly old code base written by several generations of devs with different styles.
The application deals with an SQLite database of images, referenced by ID. Users are able to query ...
0
votes
0
answers
33
views
Why does GLib.File.new_for_uri (url) fail in vala but not whilst using the same url with curl
Why does the following fail with uncaught error: HTTP Client Error: Forbidden (g-io-error-quark, 14):
static int main (string[] args) {
string url = "https://www.netfilter.org/projects/...
-4
votes
1
answer
114
views
How to create a GString from a String?
I am using Rust with GLib and need to create a GString. How do I do that?
fn example() -> GString {
let hello = "Hello";
// How do I return hello as a GString?
}
0
votes
0
answers
180
views
IsA for subclasses in GTK Rust
I'm trying to get a file dialog popup in a Rust GTK application. The window subclasses gtk::ApplicationWindow, but when I try to use it to open the dialog it gets the error
error[E0277]: the trait ...
0
votes
0
answers
123
views
Glib 2.0.0 cross compilation for android
glib cross compilation for android -Getting configure: error: cannot run test program while cross compiling error
I have tried to compile glib for android target using ./configure --host=aarch64-linux-...
2
votes
1
answer
6k
views
g_object_unref: assertion 'G_IS_OBJECT (object)' failed
I'm trying to use C to implement an video player via Gstreamer. I could run my program correctly, but occur an error: (drmDemo:871): GLib-GObject-CRITICAL **: 14:14:57.520: g_object_unref: assertion '...
0
votes
1
answer
54
views
Cannot get key handler to compile in Rust - GTK program
I'm afraid this might be a silly error, but I don't see it. The following code:
let key_handler = gtk::EventControllerKey::new();
controller.obj().add_controller(&key_handler);
key_handler....
1
vote
1
answer
57
views
Python multprocessing callback
Using this post as inspiration, I am trying to add a callback. I am using GLib.add_timeout to poll for the result, as I want to use it in a Gtk app. However, the main_quit() is not called properly, ...
0
votes
0
answers
90
views
In Gtk4 (And libadwaita), how can I exit the Gtk4 loop (Like gtk_main_quit() would)?
I am writing a library that makes use of Gtk4 and libadwaita to show dialogs. While it does work just fine, it will only show one dialog and then hang at a loop without showing anything else. In ...
0
votes
0
answers
46
views
How do I access underlying object in gtk::glib::Value?
I have produced a simple gtk GUI with glade. It merely has a spin button in an Application window. I am having trouble accessing the value of the spin button when using builder.connect_signals. My ...
0
votes
0
answers
35
views
GLib DBus: Parse (a(io)) to C readable type
I need to work with the result of a DBus operation with type (a(io)), that is an Array of [Struct of (Int32, Object Path)]. How do I (for example) print all values in this array?
My code looks like:
...
0
votes
0
answers
121
views
How to differentiate between multiple config.h headers in meson.build subprojects?
I am currently developing a library in C, using meson.build. The library contains several dependencies and I'm using wrap-files and fallback-arguments in the meson-build to integrate these ...