mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 00:40:25 +00:00
GL disp.: small fixes
- try-catch state_gl constructor (now it can throw) - added a explaining comment
This commit is contained in:
@@ -665,7 +665,12 @@ static void *display_gl_parse_fmt(struct state_gl *s, char *ptr) {
|
||||
static void * display_gl_init(struct module *parent, const char *fmt, unsigned int flags) {
|
||||
UNUSED(flags);
|
||||
|
||||
struct state_gl *s = new state_gl(parent);
|
||||
struct state_gl *s = nullptr;
|
||||
try {
|
||||
s = new state_gl(parent);
|
||||
} catch (...) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (fmt != NULL) {
|
||||
char *tmp = strdup(fmt);
|
||||
@@ -676,7 +681,7 @@ static void * display_gl_init(struct module *parent, const char *fmt, unsigned i
|
||||
LOG(LOG_LEVEL_ERROR) << MOD_NAME << "Invalid numeric value for an option!\n";
|
||||
}
|
||||
free(tmp);
|
||||
if (ret != s) {
|
||||
if (ret != s) { // ret is either nullptr or &display_init_noerr (help requested)
|
||||
delete s;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user