Bug 2571 - Improve default handler for warnings and errors on Windows
: Improve default handler for warnings and errors on Windows
Status: RESOLVED LATER
: libtiff
default
: unspecified
: PC Windows XP
: P2 enhancement
: ---
Assigned To:
:
:
: migrated_to_gitlab
:
:
  Show dependency treegraph
 
Reported: 2016-07-17 06:19 by
Modified: 2019-10-01 14:20 (History)


Attachments
win32: Automatically choose GUI or console message handler (4.01 KB, patch)
2016-07-17 06:36, Stefan Weil
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2016-07-17 06:19:36
Win32WarningHandler and Win32ErrorHandler open a message window by default. If
TIF_PLATFORM_CONSOLE is defined at compile time, messages are sent to stderr
instead of using a message window.

For console applications the current default is not optimal. Imagine software
like Tesseract doing batch processing (OCR) of image files. Then each TIFF file
with some vendor specific field will stop the batch process and show a message
window requiring user interaction.

The default message handlers could check whether there is a console and use a
message window only for GUI applications started without a console.

Sample code:

static int isGuiApp(void)
{
    return GetStdHandle(STD_ERROR_HANDLE) == NULL;
}

...

if (isGuiApp()) {
    // Output to message window.
    ...
} else {
    // Output to stderr.
    ...
}
------- Comment #1 From 2016-07-17 06:36:18 -------
Created an attachment (id=660) [details]
win32: Automatically choose GUI or console message handler
------- Comment #2 From 2019-10-01 14:20:13 -------
Bugzilla is no longer used for tracking libtiff issues. Remaining open tickets,
such as this one, have been migrated to the libtiff GitLab instance at
https://gitlab.com/libtiff/libtiff/issues .

The migrated tickets have their summary prefixed with [BZ#XXXX] where XXXX is
the initial Bugzilla issue number.