开发者

GtkLabel segmentation fault

开发者 https://www.devze.com 2023-03-27 10:06 出处:网络
I want to use use-markup, but it does not seem to wo开发者_运维知识库rk. Without it, everything works fine.

I want to use use-markup, but it does not seem to wo开发者_运维知识库rk. Without it, everything works fine.

label_markup = g_object_new(GTK_TYPE_LABEL, "wrap", TRUE, "use-markup", TRUE, "label", "<span font_desc=\"Courier New Bold 16\">Courier-span>");

Could this be caused by having the wrong development packages installed? I'm doing the 2.0 tutorials, but accidentally installed libgtk3.0-dev and then updated my repositories. Now it has been removed?!


EDIT FOR ANYONE ELSE READING THIS: The example is from the book "The Official GNOME 2 Developer's Guide" and can be found on page 114-115 - I just shortened it. Problem is that the compiler does not complain, you just won't be able to run the program without ever knowing why.


You need a NULL at the end of your g_object_new() call. Without it, there is no way of knowing how many arguments you passed, which causes the segmentation fault.

0

精彩评论

暂无评论...
验证码 换一张
取 消