Let $f(x) =\ln|\sin x| + x^2$ .
Now, on $\big[-\frac{\pi}{2} , 0\big) $, as, $|\sin x| , x^2 $ are both monotonically decreasing , so, $f(x) $ is monotonically decreasing on $\big[-\frac{\pi}{2} , 0\big) $. As $f\big(-\frac{\pi}{2}\big) = \big(\frac{\pi}{2}\big)^2 , \lim\limits_{x \to 0- } f(x) \to -\infty $ , so, $f(x)$ has one root in $\big[-\frac{\pi}{2} , 0\big) $.
Now on, $\big(0, \frac{\pi}{2} \big] $,as, $|\sin x| , x^2 $ are both monotonocally increasing , so, $f(x) $ is monotonically increasing on $\big(0, \frac{\pi}{2}\big] $. As, $f\big(\frac{\pi}{2}\big) = \big(\frac{\pi}{2}\big)^2 , \lim\limits_{x \to 0+} f(x) \to -\infty $ , so, $f(x)$ has one root in $\big(0, \frac{\pi}{2}\big] $.
Now on $\big[\frac{\pi}{2} , \pi \big) $, $f'= \cot(x) + 2x
\implies f"=-\text{cosec}^{2}(x) + 2 $
$\implies$ $f''>0$ on $ \big[\frac{\pi}{2} , k \big) $ and $f''<0$ on $(k, \pi)$ [here $k$ is the solution in $\big[\frac{\pi}{2} , \pi \big)$ of the equation $-\text{cosec}^{2}(x) + 2 = 0 $ ]
$\implies$ $f'$ increasing on $\big[\frac{\pi}{2} , k \big)$ and decreasing on $(k, \pi)$
$\implies$ $f'(x)>0 $ on $\big[\frac{\pi}{2} , k \big)$ and $f'(x)>0$ on $(k, p ) $ and $f'(x)<0 $ on $(p, \pi)$ (where $p$ is some in $(k,\pi)$ , as $f'$ is decreasing on $(k,\pi) $ ) so, $f$ is decreasing on $(p , \pi )$ , as $\lim\limits_{x \to \pi- } f(x) \to -\infty $
$\implies$ $f$ has only one root in $\big[\frac{\pi}{2}, \pi \big) $.
On $\big(\pi, \frac{3 \pi}{2} \big] $ , $|\sin x| , x^2 $ both are monotonically increasing , so, $f(x) $ is monotonically increasing on $\big(\pi, \frac{3 \pi}{2} \big] $ . As $f\big(-\frac{3 \pi}{2}\big) = \big(\frac{3 \pi}{2}\big)^2$, $\lim\limits_{x \to \pi+ } f(x) \to -\infty $, so, $f(x)$ has one root in $\big(\pi, \frac{3 \pi}{2} \big] $.
So, $f(x)$ has total of $~\boxed{4}$ roots ..