I was working on the main window when I saw this annoying little problem. Instead of creating a single top-level window that I wanted, it created two.
For resolving this I had to re-write the code to create the window.
Earlier I was loading the ui(glade) file in main.cpp but now I have resorted to creating this window via constructor call from different .cpp file.
Also I am keeping a check that there should be no warnings during compile as well as during runtime.