Repository navigation
Fix frontend bugs - #22
Merged
Merged
Conversation
added 21 commits
November 25, 2026 20:25
add_compile_options() in src/frontend/CMakeLists.txt had no effect, because the email_client_core target is created earlier. Set the options on the frontend source files only, so the rest of the project is not affected.
Initialize the virtual base TWindowInit first and members in declaration order (-Wreorder), remove an unused variable and an extra semicolon.
It was created before the login dialog, so it had an empty From field and stayed hidden under the inbox.
InboxWindow::handleEvent called TWindow::handleEvent twice, so every event was processed two times.
The last inserted view, the Exit button, had the focus, so pressing Enter closed the application instead of choosing an account.
The name buffer was allocated with new and never freed. Use a buffer on the stack instead and pass one less than its size to getText(): TListBox::getText() writes the terminating '\0' at dest[maxLen], so the old call wrote one byte past the buffer.
The JSON parse error was not caught and terminated the application. Show an empty account list instead.
"Choose" with an empty list did nothing, and an exception from set_current_email_address() terminated the application.
TEditor::buffer is a gap buffer, not a null-terminated string. After editing in the middle of the text the sent body was cut off or contained garbage. Read it character by character with bufChar().
The Cancel button had the focus, so pressing Enter right away closed the window.
Its value was ignored, mail is always sent from the logged in account. Also copy the address with strnzcpy() instead of strcpy().
Mailbox::send() and Application::send_email() now return false when the email was not sent, so the frontend can tell the user. Errors are still logged as before.
Empty fields used to be ignored silently. Now a message says what is missing, a failed send keeps the window open so the text is not lost, and a successful one is confirmed.
Labels were 6 columns wide, so "SMTP Host:" and "IMAP Host:" were cut off, and the IMAP row had a different spacing. Labels are now linked to their fields and all fields use the same length limit (IMAP host was 40, the rest 100).
As in the login dialog, the Exit button had the focus and Enter closed the application.
Check that all fields are filled in, the user is an email address, the hosts are URLs and the account does not exist yet. The account is saved only when the form is valid, and a damaged config.json is reported instead of crashing.
The file holds passwords in plain text but was created as 0664. Set it to 0600 when an account is added.
close() deletes the window, but clearEvent() was called on it afterwards. Clear the event first. AddressSanitizer reported it on every Cancel; without it the application could crash at random.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the frontend issues from the code audit (#5–#10), one change per commit.
Crashes and memory errors
Login and new account
and validation (empty fields, email address, host URLs, duplicates)
Compose
or contain garbage after editing in the middle)
Backend change
Mailbox::send()andApplication::send_email()return whether sending succeededTesting
Built with AddressSanitizer and UBSan and tested against real IMAPS (Dovecot)
and SMTPS servers: login, new account, inbox, sending, send errors, Cancel.
Builds without warnings with
-Wall -Wextra -Wpedantic(frontend only),except one in
InboxWindow::updateContent, which will change with the bodyrendering rework.