Remove GtkMenuItem from GtkMenu in app-indicator using c - c

I'm building an application that uses an app-indicator. The menu should be updated dynamically. Adding items works great using gtk_menu_shell_append, however for removing I can't find a gtk_menu_shell_* function. I've found gtk_container_remove and calling it with the gtkmenuitem and it's parent results in the following warnings:
GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GtkWidget'
Gtk-CRITICAL **: gtk_widget_get_parent: assertion `GTK_IS_WIDGET (widget)' failed
Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_CONTAINER (container)' failed
I've also tried calling gtk_widget_destory and get errors like this:
GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GtkWidget'
Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed
Note that both methods actually remove the menu item from the menu.
What is the correct way to remove a GtkMenuItem from a GtkMenu without generating these errors/warnings?

Apparently the widget was wrong somehow (don't understand why this would still work though).

Related

What does the error "1:1Typechecker Internal Error: User type in value position" mean?

I was going through the Rotatable Wallet tutorial on the Kadena beginner tutorial, and I ran into this error: "1:1Typechecker Internal Error: User type in value position". What does this mean? And where exactly is the error occurring?

Can UIProgressView be inherited?

Can UIProgressView be inherited?
I created a sub-class of UIProgressView; it works well.
But the console shows the following errors when the sub-class calls [super init] or [super initWithFrame:frame]:
<Error>: CGContextAddPath: invalid context 0x0.
<Error>: clip: invalid context 0x0.
<Error>: CGContextDrawLinearGradient: invalid context 0x0.
<Error>: CGContextAddPath: invalid context 0x0.
<Error>: clip: invalid context 0x0.
<Error>: CGContextDrawLinearGradient: invalid context 0x0.
How can I solve this problem?

How to get rid of following warning/error: Pango-CRITICAL **: pango_color_parse: assertion 'spec != NULL' failed

I keep getting the following message with some of my applications:
Pango-CRITICAL **: pango_color_parse: assertion 'spec != NULL' failed
I am using this in Fedora 22. Can I track down the source of the error. FWIW, the application "works" fine, with the exception of rendering the transparency.
Thanks for any suggestions!

How to find object / widget by name in GTK3+, Glade

I am writing a simple form in GTK+3, using C.
The form has a text entry called txtPrompt, and a submit button btnSend, created in Glade.
I am trying to access the text in textview upon button press and to do so, am using the following callback handler:
GtkBuilder *builder;
void onSubmit(GtkWidget * widget, GdkEvent * event, gpointer data) {
GObject * textView = gtk_builder_get_object(GTK_BUILDER(builder), "txtPrompt");
gchar * input = gtk_entry_get_text(GTK_ENTRY(textView));
g_print(input);
g_print("Submit clicked\n");
}
However it does not work and yields this:
(client:12905): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkBuilder'
(client:12905): Gtk-CRITICAL **: gtk_builder_get_object: assertion `GTK_IS_BUILDER (builder)' failed
(client:12905): Gtk-CRITICAL **: gtk_entry_get_text: assertion `GTK_IS_ENTRY (entry)' failed
(client:12905): GLib-CRITICAL **: g_print: assertion `format != NULL' failed
Submit clicked
Help?
After much searching, I uncommented this line from the main() code:
g_object_unref(G_OBJECT (builder));
According to a forum post, this REMOVES the reference to builder entirely!
One can then call stuff on builder within a signal handler, as per normal.

ERROR:../../mono/io-layer/handles-private.h:362

I execute my application in Debian 6 OS. From time to time there is an exception:
ERROR:../../mono/io-layer/handles-private.h:362:_wapi_handle_share_release:
assertion failed: (info->handle_refs > 0) Stacktrace:
at (wrapper managed-to-native) System.IO.MonoIO.Close
(intptr,System.IO.MonoIOError&) <0x00004> at (wrapper
managed-to-native) System.IO.MonoIO.Close
(intptr,System.IO.MonoIOError&) <0x00004> at
System.IO.FileStream.Dispose (bool) <0x00094> at
System.IO.Stream.Close () <0x0001b> at System.IO.Stream.Dispose ()
<0x00019> at (wrapper remoting-invoke-with-check)
System.IO.Stream.Dispose () <0x00053> at
Sarum.Logger.Log.WriteToFile (Sarum.Logger.SLogMessage,bool) <0x0077d>
at Sarum.Logger.Log.WriteLineAsync () <0x00212> at (wrapper
runtime-invoke) object.runtime_invoke_void_this_
(object,intptr,intptr,intptr) <0x00040>
Native stacktrace:
/usr/bin/cli() [0x80d5b19] [0xdf6600] /lib/libc.so.6(abort+0x182)
[0x13d962] /lib/libglib-2.0.so.0(g_assertion_message+0x13f)
[0xc9232f] /lib/libglib-2.0.so.0(+0x6198d) [0xc9298d] /usr/bin/cli()
[0x81df0da] /usr/bin/cli() [0x81e2d22] /usr/bin/cli() [0x81e2eb6]
/usr/bin/cli() [0x8161dc0] [0xa1c6f8] [0xa1c625] [0xa1c584]
[0xa1c752] [0x5711ec] [0x2c59ce] [0x2c41b3] [0x2832b1]
/usr/bin/cli() [0x8064428] /usr/bin/cli(mono_runtime_invoke+0x40)
[0x812d4e0] /usr/bin/cli(mono_runtime_delegate_invoke+0x34)
[0x812d764] /usr/bin/cli() [0x81284bf] /usr/bin/cli() [0x81f5e3e]
/usr/bin/cli() [0x82089a5] /lib/libpthread.so.0(+0x57b0) [0x9857b0]
/lib/libc.so.6(clone+0x5e) [0x1dc0be]
Debug info from gdb:
=================================================================
Got a SIGABRT while executing native code. This usually indicates a fatal
error in the mono runtime or one of the native libraries used by your
application.
=================================================================
** (/usr/local/bin/cserver/WadJet.CentralServer.exe:8141): WARNING **: process_set_termination_details: error looking up process handle 0x403
Why is this and how this can be combated?
There seems to be a lot of people who have reported similar errors that have plagued older versions of Mono. You might first want to try out updating the Mono as suggested here.

Resources