-
Notifications
You must be signed in to change notification settings - Fork 135
remove gtk_dialog_run #715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -186,8 +186,8 @@ void pop_info(GtkWidget* parent, const gchar* format, ...) { | |||||||||
| gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), msg); | ||||||||||
| g_free(msg); | ||||||||||
| gtk_window_set_title(GTK_WINDOW(dialog), _("Information")); | ||||||||||
| gtk_dialog_run(GTK_DIALOG(dialog)); | ||||||||||
| gtk_widget_destroy(dialog); | ||||||||||
| g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); | ||||||||||
| gtk_widget_show(dialog); | ||||||||||
|
Comment on lines
+189
to
+190
|
||||||||||
| } | ||||||||||
|
|
||||||||||
| /** | ||||||||||
|
|
@@ -216,8 +216,8 @@ void pop_warning(GtkWidget* parent, const gchar* format, ...) { | |||||||||
| gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), msg); | ||||||||||
| g_free(msg); | ||||||||||
| gtk_window_set_title(GTK_WINDOW(dialog), _("Warning")); | ||||||||||
| gtk_dialog_run(GTK_DIALOG(dialog)); | ||||||||||
| gtk_widget_destroy(dialog); | ||||||||||
| g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); | ||||||||||
| gtk_widget_show(dialog); | ||||||||||
|
Comment on lines
+219
to
+220
|
||||||||||
| g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
| gtk_widget_show(dialog); | |
| gtk_dialog_run(GTK_DIALOG(dialog)); | |
| gtk_widget_destroy(dialog); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): The response handler signature no longer matches gtk_widget_destroy.
"response" handlers receive (GtkDialog*, gint), but gtk_widget_destroy takes only a GtkWidget*. With this direct connection the gint will be treated as a pointer, causing undefined behavior or crashes. Instead, either use g_signal_connect_swapped with the dialog as user data, or create a wrapper callback matching the response signature that calls gtk_widget_destroy(dialog).