Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Long story short: use <strong>NULL</strong> when the manual says <strong>NULL</strong>, and not a plain <strong>0</strong>!</p> <p><em>(Since I can't choose the comments as an answer, I am writing the answer myself, giving credit to the helpful comments...)</em></p> <p>GTK+ documentation states this:</p> <pre><code>GtkWidget* gtk_dialog_new_with_buttons (const gchar *title, GtkWindow *parent, GtkDialogFlags flags, const gchar *first_button_text, ...); title : Title of the dialog, or NULL. allow-none. parent : Transient parent of the dialog, or NULL. allow-none. flags : from GtkDialogFlags first_button_text : stock ID or text to go in first button, or NULL. allow-none. ... : response ID for first button, then additional buttons, ending with NULL </code></pre> <p>But I was lazy that night and typed just a '0' where the NULL was expected:</p> <pre><code>settings_dialog = GTK_DIALOG(gtk_dialog_new_with_buttons("gatotray Settings" , NULL, 0, GTK_STOCK_CANCEL, FALSE, GTK_STOCK_SAVE, TRUE, 0)); </code></pre> <p>... Not noticing that NULL is a pointer which in my 64-bits system is 64-bits wide, whereas 0 is a 32-bit integer...</p> <p>Also, seems like in the variable argument list the compiler was not able to detect the inconsistency: the code compiled quietly with -Wall.</p> <p>As <a href="https://stackoverflow.com/users/70189/myforwik">Myforwik</a> suggested and <a href="https://stackoverflow.com/users/277156/havoc-p">Havoc P</a> further clarified, using 'NULL' there instead of the '0' fixed the issue. Thanks guys!</p> <p>For the record, I did a test compiling in 32 bits mode where NULL is also 32-bits, and in that case there was no segfault. It is still incorrect though, since the documentation is clear enough, and NULL is not 0, no matter what the C++ committeemen ever say! ;-)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload