pavuapplication: initialize members in the constructor

It seems that without explicit initialization of the members they remain
uninitialized. The lack of initialization caused crashing, because
PavuApplication::on_activate() creates the MainWindow only if mainWindow
is NULL, and if it's some random value instead, on_activate() calls
selectTab() on a non-existent window.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pavucontrol/issues/49
This commit is contained in:
Tanu Kaskinen 2018-10-18 15:27:10 +03:00
parent 8fc715d7d3
commit d3b3bee378
2 changed files with 9 additions and 2 deletions

View File

@ -30,7 +30,14 @@
#include "pavucontrol.h"
#include "mainwindow.h"
PavuApplication::PavuApplication() : Gtk::Application("org.pulseaudio.pavucontrol", Gio::ApplicationFlags::APPLICATION_HANDLES_COMMAND_LINE) {
PavuApplication::PavuApplication() :
Gtk::Application("org.pulseaudio.pavucontrol", Gio::ApplicationFlags::APPLICATION_HANDLES_COMMAND_LINE),
mainWindow(NULL),
retry(false),
maximize(false),
tab(0),
version(false),
m(NULL) {
}
/*

View File

@ -45,7 +45,7 @@ private:
MainWindow* create_window();
void on_hide_window(Gtk::Window* window);
pa_glib_mainloop *m = NULL;
pa_glib_mainloop *m;
};